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

Fix duplicated lines when scrolling in the pager #3272

Merged

Conversation

dscho
Copy link
Member

@dscho dscho commented Jun 14, 2021

This works around #3235 by not setting COLUMNS when Git has no clue what the correct value should be.

@dscho dscho linked an issue Jun 14, 2021 that may be closed by this pull request
@dscho
Copy link
Member Author

dscho commented Jun 14, 2021

GitGitGadget companion: gitgitgadget#982

@dscho dscho force-pushed the fix-duplicated-lines-when-moving-in-pager branch from 22d3a9a to 82099e5 Compare June 16, 2021 11:37
We query `TIOCGWINSZ` in Git to determine the correct value for
`COLUMNS`, and then set that environment variable.

If `TIOCGWINSZ` is not available, we fall back to the hard-coded value
80 _and still_ set the environment variable.

On Windows this is a problem. The reason is that Git for
Windows uses a version of `less` that relies on the MSYS2 runtime to
interact with the pseudo terminal (typically inside a MinTTY window,
which is also aware of the MSYS2 runtime). Both MinTTY and `less.exe`
interact with that pseudo terminal via `ioctl()` calls (which the MSYS2
runtime emulates even if there is no such thing on Windows).
Since gwsw/less@bb0ee4e76c2, `less` prefers
the `COLUMNS` variable over asking ncurses itself.

But `git.exe` itself is _not_ aware of the MSYS2 runtime, or for that
matter of that pseudo terminal, and has no way to call `ioctl()` or
`TIOCGWINSZ`.

Therefore, `git.exe` will fall back to hard-coding 80 columns, no matter
what the actual terminal size is.

But `less.exe` is totally able to interact with the MSYS2 runtime and
would not actually require Git's help (which actually makes things
worse here). So let's not override `COLUMNS` on Windows.

Let's just not set `COLUMNS` unless we managed to query the actual value
from the terminal.

This fixes git-for-windows#3235

Co-authored-by: Junio C Hamano <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the fix-duplicated-lines-when-moving-in-pager branch from 82099e5 to fe2ee68 Compare June 21, 2021 13:24
@dscho
Copy link
Member Author

dscho commented Jul 5, 2021

This topic finally moved into upstream's next branch.

@dscho dscho merged commit 8d1cc44 into git-for-windows:main Jul 5, 2021
@dscho dscho added this to the Next release milestone Jul 5, 2021
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 5, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 6, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 6, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 6, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
@dscho dscho deleted the fix-duplicated-lines-when-moving-in-pager branch July 9, 2021 04:34
dscho added a commit that referenced this pull request Jul 10, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 10, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 14, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 14, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 15, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 15, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 15, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 19, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 19, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 19, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 19, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 19, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 21, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 22, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Jul 23, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 24, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 24, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 24, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 26, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 28, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 28, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 29, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 29, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Jul 29, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 2, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 3, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 11, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 13, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 18, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
dscho added a commit that referenced this pull request Aug 23, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
git-for-windows-ci pushed a commit that referenced this pull request Aug 24, 2021
…in-pager

Fix duplicated lines when scrolling in the pager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated lines when moving in pager
2 participants