diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-13 09:09:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-13 09:09:28 -0700 |
commit | 25be867d0902db863686414f89e75ee0fedc1d22 (patch) | |
tree | d0e527f029038667ec1495622fa4e76e05985951 | |
parent | e8bfdef6d901431c1d69ef4d70a26451dca6e084 (diff) | |
download | txr-25be867d0902db863686414f89e75ee0fedc1d22.tar.gz txr-25be867d0902db863686414f89e75ee0fedc1d22.tar.bz2 txr-25be867d0902db863686414f89e75ee0fedc1d22.zip |
linenoise: recognize additional commands in search.
* linenoise/linenoise.c (history_search): Editing keys
should leave search mode and be processed in command mode.
Also, let's have Ctrl-L and Ctrl-Z work, but stay in search
mode.
* txr.1: Documented.
-rw-r--r-- | linenoise/linenoise.c | 10 | ||||
-rw-r--r-- | txr.1 | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 44f88211..80c2a961 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -506,7 +506,10 @@ static int history_search(lino_t *l) c = 0; break; case CTL('F'): case CTL('B'): + case CTL('A'): case CTL('E'): case CTL('N'): case CTL('P'): + case CTL('D'): case CTL('U'): case CTL('W'): case CTL('K'): + case CTL('T'): case ESC: if (hi < l->history_len) l->history_index = l->history_len - hi - 1; @@ -516,6 +519,13 @@ static int history_search(lino_t *l) case CTL('V'): vb = 1; continue; + case CTL('L'): + lino_clear_screen(l); + break; + case CTL('Z'): + disable_raw_mode(l); + raise(SIGTSTP); + enable_raw_mode(l); } } break; @@ -33574,9 +33574,13 @@ listener to resume editing the original input at the original character position. The Enter key accepts the result of a search and submits it as if it were a newly composed line. -Navigation keys may be used in search mode. A navigation key immediately -cancels search mode, and is processed in edit mode, using whatever line was -located by the search, at the matching character position. +Navigation and editing keys may be used in search mode. A navigation or editing +key immediately cancels search mode, and is processed in edit mode, using +whatever line was located by the search, at the matching character position. + +The Ctrl-L (Clear Screen and Refresh), as well as Ctrl-Z +(Suspend to Background) commands are available in search mode. Their effects +takes place without leaving search mode. Navigating to a history line manually using the up and down arrow keys (or Ctrl-P/Ctrl-N) has the same net effect same as locating that line using |