summaryrefslogtreecommitdiffstats
path: root/contrib/less/command.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2002-01-07 20:37:09 +0000
committerps <ps@FreeBSD.org>2002-01-07 20:37:09 +0000
commitbeaaa84fd0e7d42986a94208748065f685e9d6fe (patch)
tree20612717e5ecd1a4dbd5dd8b2498580eaaeb1fee /contrib/less/command.c
parent1c0805000f77e569bd5ec950432de68a3854137a (diff)
downloadFreeBSD-src-beaaa84fd0e7d42986a94208748065f685e9d6fe.zip
FreeBSD-src-beaaa84fd0e7d42986a94208748065f685e9d6fe.tar.gz
Merge vendor changes onto mainline.
Diffstat (limited to 'contrib/less/command.c')
-rw-r--r--contrib/less/command.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c
index 000cf0b..d9c177c 100644
--- a/contrib/less/command.c
+++ b/contrib/less/command.c
@@ -15,6 +15,9 @@
*/
#include "less.h"
+#if MSDOS_COMPILER==WIN32C
+#include <windows.h>
+#endif
#include "position.h"
#include "option.h"
#include "cmd.h"
@@ -216,6 +219,8 @@ exec_mca()
if (secure)
break;
edit_list(cbuf);
+ /* If tag structure is loaded then clean it up. */
+ cleantags();
break;
#endif
#if SHELL_ESCAPE
@@ -286,7 +291,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.
@@ -614,6 +619,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.
*/
@@ -838,6 +850,7 @@ commands()
PARG parg;
IFILE old_ifile;
IFILE new_ifile;
+ char *tagfile;
search_type = SRCH_FORW;
wscroll = (sc_height + 1) / 2;
@@ -1355,6 +1368,11 @@ commands()
/*
* Examine next file.
*/
+ if (ntags())
+ {
+ error("No next file", NULL_PARG);
+ break;
+ }
if (number <= 0)
number = 1;
if (edit_next(number))
@@ -1371,6 +1389,11 @@ commands()
/*
* Examine previous file.
*/
+ if (ntags())
+ {
+ error("No previous file", NULL_PARG);
+ break;
+ }
if (number <= 0)
number = 1;
if (edit_prev(number))
@@ -1380,6 +1403,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.
@@ -1508,7 +1565,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)
@@ -1518,7 +1577,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;
OpenPOWER on IntegriCloud