Skip to content

Commit

Permalink
Fix problem in getccu when ctrl-Z is entered.
Browse files Browse the repository at this point in the history
getccu calls getchr which calls iread.
When ctrl-Z (SIGTSTP) is entered, iread sets sigs |= S_STOP
and returns READ_INTR. getchr then also returns READ_INTR.
As of 2d0abe8, getccu converts any negative value like READ_INTR
to a null char, which causes getccu to ignore the char and call
getchr again. Before 2d0abe8 we would retain the negative char
and exit the loop, but the char value was not used because the
fact that sigs is set would be checked first. It seems more
straightforward to just exit the getccu loop when sigs is set.

Related to #563.
  • Loading branch information
gwsw committed Aug 30, 2024
1 parent 644733a commit 2bfad47
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

* Fix ^X bug when output is not a terminal (github #558).

* Fix bug where ^Z is not handled immediately (github #563).

======================================================================

Major changes between "less" versions 643 and 661
Expand Down
2 changes: 1 addition & 1 deletion command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ public void getcc_clear(void)
static char getccu(void)
{
int c = 0;
while (c == 0)
while (c == 0 && !ABORT_SIGS())
{
if (ungot == NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ v662 8/8/24 Fix build with --with-secure; improve true colors on Windows;
fix --header with short file; fix ^X bug when output is not tty.
v663 8/16/24 Fix ^X bug when output is not a tty.
v664 8/28/24 Fix Windows compile error, fix output bug on Windows with -Da.
v665
v665 Fix ^Z bug.
*/

char version[] = "665x";

0 comments on commit 2bfad47

Please sign in to comment.