Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less is broken in Linux #35

Closed
wants to merge 1 commit into from
Closed

Less is broken in Linux #35

wants to merge 1 commit into from

Conversation

giddie
Copy link
Contributor

@giddie giddie commented Mar 14, 2012

The -X option breaks mouse wheel scrolling for me in ArchLinux. It doesn't look like it does anything particularly useful; maybe BSD less is different?

-X or --no-init
       Disables sending the termcap initialization and deinitialization strings to the ter‐
       minal.   This  is  sometimes desirable if the deinitialization string does something
       unnecessary, like clearing the screen.

@sorin-ionescu
Copy link
Owner

I remember what that does. This is not a bug; it's a preference.

It prevents less from using the alternate screen and clearing the buffer when it exists. This allows you to write a command while referring to the man page, which is still partially on screen while less has exited.

I will not merge this.

@giddie
Copy link
Contributor Author

giddie commented Mar 14, 2012

Fair enough. On balance, though, I would not have thought this was the expected behaviour. I do hope you're rejecting this because you believe most people want this behaviour, and not because this is the behaviour you want. If your fork becomes OMZ 2, it'll have to cater to the majority out of the box. Just my opinion; take it or leave it. I really appreciate all the work you've put into this already.

@ColinHebert
Copy link
Contributor

An overridden (and commented) version of $LESS without -X could be added to the zshrc template with a comment above to explain the issue.

This way, mac users will just ignore it, and linux users will be able to fix the -X issue easily.

@sorin-ionescu
Copy link
Owner

It's not Mac vs Linux. I have read a lot of blog posts and dot files when I wrote those less options. Some prefer -X; others, do not. There is benefit to -X because you do not need two terminal windows open (one for the man page and another for your command). You can just quit less, and the relevant portion of the man page is in front of you because it does not clear the screen. Execute the command and move on. I'll try to fit in a comment.

@giddie
Copy link
Contributor Author

giddie commented Mar 14, 2012

OK, I respect your opinion Sorin. If you think more people will want less to have -X, that's fine. To me, the behaviour felt broken, because I rely heavily on mouse scrolling in less (h and j are too slow, and I don't like the context jumps that result from Page Up / Page Down).

I do think another zstyle option in the .zshrc might be in order, though.

@ColinHebert
Copy link
Contributor

What I meant to say isn't the mac/linux thing, I just presented it that way because the title of the issue is "Less broken in Linux" (I shouldn't have said it like that), it was more "A comment explaining to the users how the default -X could create a strange behaviour and how could it be fixed easily".

@sorin-ionescu
Copy link
Owner

I disagree on the zstyle. Less has too many switches.

@giddie
Copy link
Contributor Author

giddie commented Mar 14, 2012

Hmm; yes less has plenty of switches, but I see this as a serious issue that at least deserves a configuration option for two reasons:

  1. You say that your rationale for setting -X by default is that you want to be able to see part of the manpage when you return to the prompt. Well, I have the opposite problem. I often enter a manpage to check something quickly, and want to see the output from previous commands when I return. This is clearly a matter of preference, and so on these grounds there is no strong argument for -X or against it.

  2. There's a "principle of least surprise" issue here. As far as the average user is concerned, less, man, and other paging commands act like a special scrolling buffer. They can go up and down. In every other situation where you can go up and down (including outside a pager), the scrollwheel does the expected thing. However, when -X is added, scrolling up breaks the "special buffer" metaphor pretty badly: the bottom status disappears as it scrolls away, and what you see scrolling in at the top can be pretty weird, depending on what you were doing before you reached for the mouse. It is not immediately obvious that this is cause by a switch passed to less; my first thought was some terminal initialisation bug or oversight in terminal.zsh.

On the other hand, if -X is not there, the least surprising thing happens: your mouse scrolls the buffer. Maybe it's not the desired behaviour (we can assume this will be true for half the power-users). Those users that want the -X behaviour will almost certainly know how to enable it, or will have no trouble looking it up.

If you're dead-set of having -X set by default, I really think there must be a configuration option, so that it's immediately obvious to everyone doing even a cursory examination of their new setup that this is an issue.

@sorin-ionescu sorin-ionescu reopened this Mar 14, 2012
@vguerci vguerci mentioned this pull request Mar 18, 2012
lildude pushed a commit to lildude/prezto that referenced this pull request Jan 12, 2014
While the '-X' switch allows the user to quit less with the relevant
portion of a man page still visible, it breaks mouse scrolling.
lildude pushed a commit to lildude/prezto that referenced this pull request Jan 12, 2014
lildude pushed a commit to lildude/prezto that referenced this pull request Jan 9, 2016
kodelint pushed a commit to kodelint/prezto that referenced this pull request Nov 15, 2016
Fix for Issue sorin-ionescu#35 "Unclosed brackets not marked as error"
kodelint pushed a commit to kodelint/prezto that referenced this pull request Nov 15, 2016
RIT80 pushed a commit to RIT80/prezto that referenced this pull request Jan 25, 2022
While the '-X' switch allows the user to quit less with the relevant
portion of a man page still visible, it breaks mouse scrolling.
RIT80 pushed a commit to RIT80/prezto that referenced this pull request Jan 25, 2022
RIT80 added a commit to RIT80/prezto that referenced this pull request Jan 25, 2022
While the '-X' switch allows the user to quit less with the relevant
portion of a man page still visible, it breaks mouse scrolling.
RIT80 added a commit to RIT80/prezto that referenced this pull request Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants