summaryrefslogtreecommitdiffstats
path: root/contrib/less/command.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2007-11-16 22:24:31 +0000
committerdelphij <delphij@FreeBSD.org>2007-11-16 22:24:31 +0000
commit12ee5edf2f2943fb7ff47149c5bfba7f36b865b2 (patch)
tree840e6427c104a75a42837ced5e3276f0d2f98534 /contrib/less/command.c
parent6c8bd91302f47331d99af5e633b06e68121fd73d (diff)
downloadFreeBSD-src-12ee5edf2f2943fb7ff47149c5bfba7f36b865b2.zip
FreeBSD-src-12ee5edf2f2943fb7ff47149c5bfba7f36b865b2.tar.gz
Resolve conflicts; Update defines.h to reflect latest change.
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 032606b..e42d9ce 100644
--- a/contrib/less/command.c
+++ b/contrib/less/command.c
@@ -558,6 +558,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
@@ -580,11 +595,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;
}
}
@@ -1115,7 +1139,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
@@ -1154,14 +1181,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:
/*
@@ -1263,7 +1283,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);
OpenPOWER on IntegriCloud