diff options
author | delphij <delphij@FreeBSD.org> | 2007-11-16 22:22:17 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2007-11-16 22:22:17 +0000 |
commit | e2b0c4a1d9f9f53e73cf7da116a4546c07cde418 (patch) | |
tree | 0c9762eeda7d2def39527db440983a3ea2c88c41 /contrib/less/command.c | |
parent | 9680b7d49a594123cfffb2bc9d11614d1a2625d0 (diff) | |
download | FreeBSD-src-e2b0c4a1d9f9f53e73cf7da116a4546c07cde418.zip FreeBSD-src-e2b0c4a1d9f9f53e73cf7da116a4546c07cde418.tar.gz |
Virgin import of less v415.
Diffstat (limited to 'contrib/less/command.c')
-rw-r--r-- | contrib/less/command.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c index ff48909..ef6dfa4 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -552,6 +552,21 @@ mca_char(c) } /* + * Discard any buffered file data. + */ + static void +clear_buffers() +{ + if (!(ch_getflags() & CH_CANSEEK)) + return; + ch_flush(); + clr_linenum(); +#if HILITE_SEARCH + clr_hilite(); +#endif +} + +/* * Make sure the screen is displayed. */ static void @@ -574,11 +589,20 @@ make_display() jump_loc(initial_scrpos.pos, initial_scrpos.ln); } else if (screen_trashed) { - int save_top_scroll; - save_top_scroll = top_scroll; + int save_top_scroll = top_scroll; + int save_ignore_eoi = ignore_eoi; top_scroll = 1; + ignore_eoi = 0; + if (screen_trashed == 2) + { + /* Special case used by ignore_eoi: re-open the input file + * and jump to the end of the file. */ + reopen_curr_ifile(); + jump_forw(); + } repaint(); top_scroll = save_top_scroll; + ignore_eoi = save_ignore_eoi; } } @@ -1109,7 +1133,10 @@ commands() ignore_eoi = 1; hit_eof = 0; while (!sigs) + { + make_display(); forward(1, 0, 0); + } ignore_eoi = 0; /* * This gets us back in "F mode" after processing @@ -1148,14 +1175,7 @@ commands() * Flush buffers, then repaint screen. * Don't flush the buffers on a pipe! */ - if (ch_getflags() & CH_CANSEEK) - { - ch_flush(); - clr_linenum(); -#if HILITE_SEARCH - clr_hilite(); -#endif - } + clear_buffers(); /* FALLTHRU */ case A_REPAINT: /* @@ -1257,7 +1277,8 @@ commands() /* * Define abbreviation for a commonly used sequence below. */ -#define DO_SEARCH() if (number <= 0) number = 1; \ +#define DO_SEARCH() \ + if (number <= 0) number = 1; \ mca_search(); \ cmd_exec(); \ multi_search((char *)NULL, (int) number); |