pr-982/dscho/fix-duplicated-lines-when-moving-in-pager-v3
tagged this
21 Jun 16:57
From: Johannes Schindelin <johannes.schindelin@gmx.de> 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 https://github.com/gwsw/less/commit/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 https://github.com/git-for-windows/git/issues/3235 Co-authored-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Submitted-As: https://lore.kernel.org/git/pull.982.v3.git.1624294679495.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.982.git.1623701952823.gitgitgadget@gmail.com In-Reply-To: https://lore.kernel.org/git/pull.982.v2.git.1623847092299.gitgitgadget@gmail.com
Assets 2
-
2021-06-21T16:57:59Z -
2021-06-21T16:57:59Z -