diff options
author | pgen <p.gen.progs@gmail.com> | 2018-08-12 17:25:01 +0200 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2018-08-12 17:25:01 +0200 |
commit | c35ef2fadedadf42921fc71497cf6a5a3314a1fa (patch) | |
tree | 9d3296a4913a13b97d143a9587477fecfeb8e6a6 | |
parent | 0f87d313cb857631b8fcd1aefd6947e88131cfc4 (diff) |
Make ^A/^Z the same as Home/End is search mode
-rw-r--r-- | smenu.1 | 7 | ||||
-rw-r--r-- | smenu.c | 16 |
2 files changed, 21 insertions, 2 deletions
@@ -190,6 +190,9 @@ The user can then use the \fBn\fP/\fBSPACE\fP keys (forward) and the If the user hits the \fBHome\fP or \fBEnd\fP key during a search session then the matched word list is reduced to the words starting (respectively) ending with the current search pattern and the window is refreshed. +For those who consider \fBHome\fP and \fBEnd\fP as non-intuitive, +the \fBCTRL-A\fP and \fBCtrl-Z\fP keys are also available in search mode +as an alternative. This behaviour is persistent until the user hit the \fBESC\fP or \fBENTER\fP key. @@ -241,10 +244,10 @@ CTRL+Home, SHIFT+Home, CTRL+k@First word@Yes PgDn@Next pages@Yes CTRL+End, SHIFT+End, CTRL+j@Last word@Yes -Home@T{ +Home,CTRL-A@T{ Only keep the words starting with the search pattern T}@No -End@T{ +End,CTRL-Z@T{ Only keep the words ending with the search pattern T}@No @@ -10357,6 +10357,18 @@ main(int argc, char * argv[]) switch (buffer[0]) { + case 0x01: /* ^A */ + if (search_mode != NONE) + goto khome; + + break; + + case 0x1a: /* ^Z */ + if (search_mode != NONE) + goto kend; + + break; + case 0x1b: /* ESC */ /* An escape sequence or a multibyte character has been pressed */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ @@ -10370,6 +10382,8 @@ main(int argc, char * argv[]) /* """"""""""""""""""""""""" */ if (search_mode != NONE) { + khome: + search_data.only_starting = 1; search_data.only_ending = 0; select_starting_matches(&win, &term, &search_data, &last_line); @@ -10414,6 +10428,8 @@ main(int argc, char * argv[]) /* """""""""""""""""""""""" */ if (search_mode != NONE) { + kend: + if (matches_count > 0 && search_mode != PREFIX) { search_data.only_starting = 0; |