aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/command.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2007-11-16 22:22:17 +0000
committerXin LI <delphij@FreeBSD.org>2007-11-16 22:22:17 +0000
commit464501a8bf6415e8337a98f2931a57b67df8cfea (patch)
tree0c9762eeda7d2def39527db440983a3ea2c88c41 /contrib/less/command.c
parentf78327b5b082629d7ecb08e0166a1ee5820871d7 (diff)
downloadsrc-464501a8bf6415e8337a98f2931a57b67df8cfea.tar.gz
src-464501a8bf6415e8337a98f2931a57b67df8cfea.zip
Virgin import of less v415.
Notes
Notes: svn path=/vendor/less/dist/; revision=173682
Diffstat (limited to 'contrib/less/command.c')
-rw-r--r--contrib/less/command.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c
index ff48909f8ca8..ef6dfa464e8c 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);