Control: tags -1 patch
On 2019-06-28 15:36:25 +0200, Vincent Lefevre wrote:
> This is where the behavior gets changed, in forwback.c:
>
> /*
> * If this is the first screen displayed and
> * we hit an early EOF (i.e. before the requested
> * number of lines), we "squish" the display down
> * at the bottom of the screen.
> * But don't do this if a + option or a -t option
> * was given. These options can cause us to
> * start the display after the beginning of the file,
> * and it is not appropriate to squish in that case.
> */
> if (first_time && pos == NULL_POSITION && !top_scroll &&
> #if TAGS
> tagoption == NULL &&
> #endif
> !plusoption)
> {
> squished = 1;
> continue;
> }
>
> With top_scroll being true, this "if" condition is false and "screen"
> still waits for input to paint the screen, instead of assuming that
> there is no more input (for the moment) and display the prompt
> immediately.
>
> The issue is with the "put_line();" that follows. In the put_line
> code from output.c:
>
> if (ABORT_SIGS())
> {
> /*
> * Don't output if a signal is pending.
> */
> screen_trashed = 1;
> return;
> }
>
> If I remove this, everything is fine.
I think that a solution would be to take Ctrl-C into account just
before the "put_line();" above.
I'm currently using the attached patch.
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Description: Honor Ctrl-C when a + or -c option is given
Author: Vincent Lefevre <[email protected]>
Bug-Debian: https://bugs.debian.org/931216
Last-Update: 2019-06-28
Index: less-487/forwback.c
===================================================================
--- less-487.orig/forwback.c
+++ less-487/forwback.c
@@ -260,6 +260,18 @@ forw(n, pos, force, only_last, nblank)
squished = 1;
continue;
}
+ /*
+ * Process S_INTERRUPT now. Otherwise, if a + or -c option
+ * is given, and Ctrl-C will have no effect due to the
+ * ABORT_SIGS() condition in put_line: input will still
+ * be considered for the output. Examples in bash/zsh:
+ * less -f +1 <(echo foo; sleep 3; echo bar)
+ * less -f -c <(echo foo; sleep 3; echo bar)
+ * Note: This must not be done for Ctrl-Z, otherwise the
+ * display is incorrect after "fg".
+ */
+ if (sigs & S_INTERRUPT)
+ psignals();
put_line();
#if 0
/* {{