diff options
author | ps <ps@FreeBSD.org> | 2002-01-07 20:29:38 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2002-01-07 20:29:38 +0000 |
commit | c0c85bc41cb6c023adae56cf0a7e3495bd528cb2 (patch) | |
tree | 22ed5b4269586d3d5c21d37a27645897709341e3 /contrib/less/command.c | |
parent | 5d465776b9e058088e1f29636cf7cdcb0c13eb0d (diff) | |
download | FreeBSD-src-c0c85bc41cb6c023adae56cf0a7e3495bd528cb2.zip FreeBSD-src-c0c85bc41cb6c023adae56cf0a7e3495bd528cb2.tar.gz |
Import less v371
Diffstat (limited to 'contrib/less/command.c')
-rw-r--r-- | contrib/less/command.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c index d898ed1..44c9d96 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -14,6 +14,9 @@ */ #include "less.h" +#if MSDOS_COMPILER==WIN32C +#include <windows.h> +#endif #include "position.h" #include "option.h" #include "cmd.h" @@ -214,6 +217,8 @@ exec_mca() if (secure) break; edit_list(cbuf); + /* If tag structure is loaded then clean it up. */ + cleantags(); break; #endif #if SHELL_ESCAPE @@ -284,7 +289,7 @@ mca_char(c) * Terminated by a non-digit. */ if ((c < '0' || c > '9') && - editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE) == A_INVALID) + editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) { /* * Not part of the number. @@ -608,6 +613,13 @@ prompt() quit(QUIT_OK); #endif +#if MSDOS_COMPILER==WIN32C + /* + * In Win32, display the file name in the window title. + */ + if (!(ch_getflags() & CH_HELPFILE)) + SetConsoleTitle(pr_expand("Less?f - %f.", 0)); +#endif /* * Select the proper prompt and display it. */ @@ -832,6 +844,7 @@ commands() PARG parg; IFILE old_ifile; IFILE new_ifile; + char *tagfile; search_type = SRCH_FORW; wscroll = (sc_height + 1) / 2; @@ -1349,6 +1362,11 @@ commands() /* * Examine next file. */ + if (ntags()) + { + error("No next file", NULL_PARG); + break; + } if (number <= 0) number = 1; if (edit_next(number)) @@ -1365,6 +1383,11 @@ commands() /* * Examine previous file. */ + if (ntags()) + { + error("No previous file", NULL_PARG); + break; + } if (number <= 0) number = 1; if (edit_prev(number)) @@ -1374,6 +1397,40 @@ commands() } break; + case A_NEXT_TAG: + if (number <= 0) + number = 1; + tagfile = nexttag(number); + if (tagfile == NULL) + { + error("No next tag", NULL_PARG); + break; + } + if (edit(tagfile) == 0) + { + POSITION pos = tagsearch(); + if (pos != NULL_POSITION) + jump_loc(pos, jump_sline); + } + break; + + case A_PREV_TAG: + if (number <= 0) + number = 1; + tagfile = prevtag(number); + if (tagfile == NULL) + { + error("No previous tag", NULL_PARG); + break; + } + if (edit(tagfile) == 0) + { + POSITION pos = tagsearch(); + if (pos != NULL_POSITION) + jump_loc(pos, jump_sline); + } + break; + case A_INDEX_FILE: /* * Examine a particular file. @@ -1502,7 +1559,9 @@ commands() goto again; case A_LSHIFT: - if (number <= 0) + if (number > 0) + shift_count = number; + else number = (shift_count > 0) ? shift_count : sc_width / 2; if (number > hshift) @@ -1512,7 +1571,9 @@ commands() break; case A_RSHIFT: - if (number <= 0) + if (number > 0) + shift_count = number; + else number = (shift_count > 0) ? shift_count : sc_width / 2; hshift += number; |