Fix tabs not preserved in raw mode#620
Conversation
|
Can you explain the motivation for this change? Normally less does not output tabs, but can be configured to do so via the -U option. In that case, currently less configures the tty driver to expand tabs to spaces. This PR configures the driver to output raw tabs instead. I think an argument could be made for either behavior. I can also see an argument to leave the TAB bits unchanged so that the tty driver does whatever the user has configured it to do outside less. |
|
The primary motivation is to be able to copy diffs when eg. using
IMO this behavior is more useful because the current behavior is a no-op for tabs in raw mode, and if one still wants expansion in raw mode, they can get it with Line 373 in 26cfc73
That's what my patch did initially, but then I saw: Line 631 in 26cfc73 I guess that line would also need to be tweaked? I don't have a strong opinion on this part tbh, and since the user can control it, it doesn't hurt. |
|
I think the modified patch is ok. It was clearly wrong for the behavior to be different depending on whether TCGETA or TIOCGETP is supported. However, I think the change should be made only to screen.c, not subsearch.lt nor term.c. The subsearch.lt file is not source code, it is just using an old copy of screen.c as a text file for one of the tests. And in term.c which is part of the lesstest program, the behavior should be deterministic, not dependent on how the user has set his terminal. The exact behavior (tabs expanded or not) doesn't really matter, but it does matter that the behavior is the same for every user, regardless of their tty configuration. |
|
That makes sense. Updated the patch to only change screen.c. |
Release notes (https://www.greenwoodsoftware.com/less/news.678.html): Version 678 was released for beta testing on 2 May 2025, and was released for general use on 17 May 2025. These are the differences between [version 668](https://www.greenwoodsoftware.com/less/news.668.html) and version 678: - Treat -r in LESS environment variable as -R. - Add ESC-j and ESC-k commands ([github msys2#560](gwsw/less#560)). - Add --no-paste option ([github msys2#523](gwsw/less#523)). - Add --no-edit-warn option ([github msys2#513](gwsw/less#513)). - Add --form-feed option ([github msys2#496](gwsw/less#496)). - Add ESC-b command ([github msys2#615](gwsw/less#615)). - Make TAB complete option name in -- command ([github msys2#531](gwsw/less#531)). - Update the file size on an attempt to go past end of file. - Make -R able to pass through any OSC escape sequences, not just OSC 8 ([github msys2#504](gwsw/less#504)). - Setting LESS_IS_MORE=0 now disables "more" compatibility even if invoked via a file link named "more" ([github msys2#500](gwsw/less#500)). - Pass through escape sequences in prompts even if -R is not set. - Add LESS_SHELL_LINES to support shell prompts which use more than one line ([github msys2#514](gwsw/less#514)). - Add LESSANSIOSCALLOW to define OSC types which may be passed through. - Add LESSANSIOSCCHARS to define non-standard OSC intro chars. - Add LESS_SIGUSR1 to define user signal handler ([github msys2#582](gwsw/less#582)). - Add mouse and mouse6 commands to lesskey ([github msys2#569](gwsw/less#569)). - Improve behavior of ^O^N and ^O^P commands. - Leave stty tabs setting unchanged ([github msys2#620](gwsw/less#620)). - Fix unexpected behavior when entering a partial command followed by a valid command ([github msys2#543](gwsw/less#543)). - Fix bug when coloring prompt string with SGR sequences ([github msys2#516](gwsw/less#516)). - Fix bug when searching for text near an invalid UTF-8 sequence ([github msys2#542](gwsw/less#542)). - Fix display bug when file contains ESC followed by NUL ([github msys2#550](gwsw/less#550)). - Fix bug when using +:n +:p +:x or +:d on the command line ([github msys2#552](gwsw/less#552)). - Fix bug with --no-number-headers when header is not at start of file ([github msys2#566](gwsw/less#566)). - Fix bug where lesstest fails if window is resized ([github msys2#570](gwsw/less#570)). - Fix bug using "configure --with-secure=no" ([github msys2#584](gwsw/less#584)). - Fix bug using multibyte command chars ([github msys2#595](gwsw/less#595)). - Fix auto_wrap setting on Windows ([github msys2#497](gwsw/less#497)). - Fix two bugs using ^S search modifier ([github msys2#605](gwsw/less#605)). - Fix bug searching for UTF-8 strings with the PCRE2 library ([github msys2#610](gwsw/less#610)). - Fix bug highlighting OSC 8 links when opening a new file. - Fix bug when & filtering is active ([github msys2#618](gwsw/less#618)). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Release notes (https://www.greenwoodsoftware.com/less/news.678.html): Version 678 was released for beta testing on 2 May 2025, and was released for general use on 17 May 2025. These are the differences between [version 668](https://www.greenwoodsoftware.com/less/news.668.html) and version 678: - Treat -r in LESS environment variable as -R. - Add ESC-j and ESC-k commands ([github #560](gwsw/less#560)). - Add --no-paste option ([github #523](gwsw/less#523)). - Add --no-edit-warn option ([github #513](gwsw/less#513)). - Add --form-feed option ([github #496](gwsw/less#496)). - Add ESC-b command ([github #615](gwsw/less#615)). - Make TAB complete option name in -- command ([github #531](gwsw/less#531)). - Update the file size on an attempt to go past end of file. - Make -R able to pass through any OSC escape sequences, not just OSC 8 ([github #504](gwsw/less#504)). - Setting LESS_IS_MORE=0 now disables "more" compatibility even if invoked via a file link named "more" ([github #500](gwsw/less#500)). - Pass through escape sequences in prompts even if -R is not set. - Add LESS_SHELL_LINES to support shell prompts which use more than one line ([github #514](gwsw/less#514)). - Add LESSANSIOSCALLOW to define OSC types which may be passed through. - Add LESSANSIOSCCHARS to define non-standard OSC intro chars. - Add LESS_SIGUSR1 to define user signal handler ([github #582](gwsw/less#582)). - Add mouse and mouse6 commands to lesskey ([github #569](gwsw/less#569)). - Improve behavior of ^O^N and ^O^P commands. - Leave stty tabs setting unchanged ([github #620](gwsw/less#620)). - Fix unexpected behavior when entering a partial command followed by a valid command ([github #543](gwsw/less#543)). - Fix bug when coloring prompt string with SGR sequences ([github #516](gwsw/less#516)). - Fix bug when searching for text near an invalid UTF-8 sequence ([github #542](gwsw/less#542)). - Fix display bug when file contains ESC followed by NUL ([github #550](gwsw/less#550)). - Fix bug when using +:n +:p +:x or +:d on the command line ([github #552](gwsw/less#552)). - Fix bug with --no-number-headers when header is not at start of file ([github #566](gwsw/less#566)). - Fix bug where lesstest fails if window is resized ([github #570](gwsw/less#570)). - Fix bug using "configure --with-secure=no" ([github #584](gwsw/less#584)). - Fix bug using multibyte command chars ([github #595](gwsw/less#595)). - Fix auto_wrap setting on Windows ([github #497](gwsw/less#497)). - Fix two bugs using ^S search modifier ([github #605](gwsw/less#605)). - Fix bug searching for UTF-8 strings with the PCRE2 library ([github #610](gwsw/less#610)). - Fix bug highlighting OSC 8 links when opening a new file. - Fix bug when & filtering is active ([github #618](gwsw/less#618)). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
No description provided.