diff options
Diffstat (limited to 'contrib/less/command.c')
-rw-r--r-- | contrib/less/command.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c index da0f3ea..18ea4d4 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,5 +1,6 @@ +/* $FreeBSD$ */ /* - * Copyright (C) 1984-2007 Mark Nudelman + * Copyright (C) 1984-2005 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -23,6 +24,7 @@ extern int erase_char, erase2_char, kill_char; extern int sigs; +extern int quit_at_eof; extern int quit_if_one_screen; extern int squished; extern int hit_eof; @@ -37,6 +39,7 @@ extern int ignore_eoi; extern int secure; extern int hshift; extern int show_attn; +extern int more_mode; extern char *every_first_cmd; extern char *curr_altfilename; extern char version[]; @@ -53,8 +56,6 @@ extern char *editproto; #endif extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; -extern int oldbot; -extern int forw_prompt; static char ungot[UNGOT_SIZE]; static char *ungotp = NULL; @@ -64,7 +65,6 @@ static char *shellcmd = NULL; /* For holding last shell command for "!!" */ static int mca; /* The multicharacter command (action) */ static int search_type; /* The previous type of search */ static LINENUM number; /* The number typed by the user */ -static long fraction; /* The fractional part of the number */ static char optchar; static int optflag; static int optgetname; @@ -77,7 +77,7 @@ static char pipec; static void multi_search(); /* - * Move the cursor to start of prompt line before executing a command. + * Move the cursor to lower left before executing a command. * This looks nicer if the command takes a long time before * updating the screen. */ @@ -85,7 +85,7 @@ static void multi_search(); cmd_exec() { clear_attn(); - line_left(); + lower_left(); flush(); } @@ -100,7 +100,6 @@ start_mca(action, prompt, mlist, cmdflags) int cmdflags; { mca = action; - clear_bot(); clear_cmd(); cmd_putstr(prompt); set_mlist(mlist, cmdflags); @@ -123,7 +122,6 @@ mca_search() else mca = A_B_SEARCH; - clear_bot(); clear_cmd(); if (search_type & SRCH_NO_MATCH) @@ -159,7 +157,6 @@ mca_opt_toggle() dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; mca = A_OPT_TOGGLE; - clear_bot(); clear_cmd(); cmd_putstr(dash); if (optgetname) @@ -296,14 +293,14 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if (!((c >= '0' && c <= '9') || c == '.') && + if ((c < '0' || c > '9') && editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) { /* * Not part of the number. * Treat as a normal command character. */ - number = cmd_int(&fraction); + number = cmd_int(); mca = 0; cmd_accept(); return (NO_MCA); @@ -484,12 +481,16 @@ mca_char(c) flag = 0; switch (c) { - case CONTROL('E'): /* ignore END of file */ case '*': + if (more_mode) + break; + case CONTROL('E'): /* ignore END of file */ flag = SRCH_PAST_EOF; break; - case CONTROL('F'): /* FIRST file */ case '@': + if (more_mode) + break; + case CONTROL('F'): /* FIRST file */ flag = SRCH_FIRST_FILE; break; case CONTROL('K'): /* KEEP position */ @@ -611,7 +612,7 @@ prompt() * {{ Relying on "first prompt" to detect a single-screen file * fails if +G is used, for example. }} */ - if ((get_quit_at_eof() == OPT_ONPLUS || quit_if_one_screen) && + if ((quit_at_eof == OPT_ONPLUS || quit_if_one_screen) && hit_eof && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); @@ -621,7 +622,7 @@ prompt() * If the -e flag is set and we've hit EOF on the last file, * and the file is squished (shorter than the screen), quit. */ - if (get_quit_at_eof() && squished && + if (quit_at_eof && squished && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); #endif @@ -636,20 +637,7 @@ prompt() /* * Select the proper prompt and display it. */ - /* - * If the previous action was a forward movement, - * don't clear the bottom line of the display; - * just print the prompt since the forward movement guarantees - * that we're in the right position to display the prompt. - * Clearing the line could cause a problem: for example, if the last - * line displayed ended at the right screen edge without a newline, - * then clearing would clear the last displayed line rather than - * the prompt line. - */ - if (!forw_prompt) - clear_bot(); clear_cmd(); - forw_prompt = 0; p = pr_string(); if (p == NULL || *p == '\0') putchr(':'); @@ -659,7 +647,6 @@ prompt() putstr(p); at_exit(); } - clear_eol(); } /* @@ -1180,17 +1167,11 @@ commands() * Go to a specified percentage into the file. */ if (number < 0) - { number = 0; - fraction = 0; - } if (number > 100) - { number = 100; - fraction = 0; - } cmd_exec(); - jump_percent((int) number, fraction); + jump_percent((int) number); break; case A_GOEND: @@ -1411,7 +1392,7 @@ commands() number = 1; if (edit_next((int) number)) { - if (get_quit_at_eof() && hit_eof && + if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE)) quit(QUIT_OK); parg.p_string = (number > 1) ? "(N-th) " : ""; |