Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPager breaks cli history with wide output? #399
Comments
|
It is configurable.
That sets the PAGER env var to Alternatively, you can set PAGER to |
|
Thanks for the response. The problem isn't the horizontal scrolling in less, it's that the less output is written to the same display as the pgcli repl. If you run |
|
Yes. I chose a specific set of I'll take that into consideration for the future release and provide a way to override that behavior. |
|
@amjith aren't the less defaults (
|
|
The code as it is now, reads the current value set in The reasoning behind this decision is that an average user is unlikely to have set their So pgcli tries to set some sane values for LESS options. This has served well up until now. Your suggested correction is a good compromise. It won't stomp the user value (assuming the user has deliberately set it to their choosing). Would you mind making that a PR? |
|
I made a patch pik@ad6687f - but I am reconsidering it's usefulness now -- primarily because less will function somewhat differently within pgcli than it does on terminal. I guess there are two issues here: One is custom less flags which atm can be configured using Looking at how psql handles this when a pager is configured -- it seems they use a native print (?) for lines that fit the screen and switch to the pager when the output does not fit the screen; less when run without Still, following psql it would be nice to offer an output option based on whether the lines exceed terminal length or not -- e.g. there could be a config option such as
|
|
I'm not sure I entirely follow your request. So let me rephrase it to see if I understand it correctly. You'd like to show the output via I think that can be achieved using the One of the advantages of rewriting pgcli from scratch is I don't have to recreate the mistakes made by psql. So I don't think following psql behavior in using a custom display for short lines and pager output for long lines is a good approach. |
|
I think it will always clear if you don't use the
The thing is that while having visible output in a session is very useful, the way less reprints horizontally scrolled output makes viewing prior history in a session nearly impossible that is to say I would prefer to hide it in those specific cases. (I'm not saying this should be a default behaviour but it would be quite nice to have that option). |
Ah, got it. That was introduced by the |
|
I finally get what you're saying. A picture is indeed worth a thousand words. :) Let me summarize it. If the output fits in the screen (horizontally) then show the output in the screen and keep it there. If the output is wider than the screen then use the separate screen and clear the screen when the user quits the pager. Is that an accurate assessment? If so, it can be achieved by setting the less options to -RXF when the output fits the screen, when the output doesn't fit the screen then use -SRF and omit the '-X' is that right? I believe that is possible. Because we recently implemented |
|
I'm still having this problem the problem in the gif in #399 (comment) ; each time I scroll horizontally in paged output, the output gets "stuck" into the scrollback, unlike psql where closing the paged output makes it disappear entirely. I have |
|
@blendmaster You'll want to remove the $ export LESS="-SRF"Then give it a try :) If you want the change to be permanent, you'll want to put that line in your |
|
Hmm, no luck with explicitly setting LESS, even on an empty
the pager within psql works fine still. |
|
@blendmaster Ah, my bad, I forgot that pgcli overrides @amjith @j-bennet Do you think we should make it like mycli where it only overrides |
|
Yes. I think we should use the LESS var if it's available. My bad for forcibly overriding it in the code. |
|
I had a PR that fixed this (amongst other things awhile ago) #409 Personally I've given up on using pgcli and went back to psql, because the display of output is incredibly bad for a number of common cases (this is just one of them) and there doesn't seem to be much interest in getting it fixed. |
|
@pik I'm sorry you felt discouraged by the output. We are making progress in that front. I did steal many of the ideas from your PR and integrated it into pgcli. I'm sorry I couldn't merge in the full PR as it stood. We will be making the pager configurable by the user and not override the LESS variable if set by the user. I know @tsroten recently made that change to mycli which we plan on porting over to pgcli. I completely understand that pgcli didn't measure up to your expectation and you had to go back to psql. I wouldn't mind learning about the common cases where it failed to display the output appropriately. |
|
I'm closing this, because we do not force a specific PAGER and LESS anymore. |



I'm not sure if there is a configurable setting to fix this but the default is insanely bad. Scrolling up I have dozens of screens that look like this (when using arrow keys to horizontal scroll the warped columns, which essential destroys the ability to scroll up and see query history).