diff options
Diffstat (limited to 'system/ksh-openbsd/patches/05-ksh-print-expansions-like-a-menu-with-numbers-in-vi-.diff')
-rw-r--r-- | system/ksh-openbsd/patches/05-ksh-print-expansions-like-a-menu-with-numbers-in-vi-.diff | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/system/ksh-openbsd/patches/05-ksh-print-expansions-like-a-menu-with-numbers-in-vi-.diff b/system/ksh-openbsd/patches/05-ksh-print-expansions-like-a-menu-with-numbers-in-vi-.diff new file mode 100644 index 0000000000..135f5054c3 --- /dev/null +++ b/system/ksh-openbsd/patches/05-ksh-print-expansions-like-a-menu-with-numbers-in-vi-.diff @@ -0,0 +1,105 @@ +From 91ebd29a64451742b65115fc27034c6a3d154f90 Mon Sep 17 00:00:00 2001 +From: Alexander Polakov <polachok@gmail.com> +Date: Sun, 29 May 2011 15:41:53 +0400 +Subject: [PATCH 5/8] ksh: print expansions like a "menu" (with numbers) in vi + mode + + * adds an extra argument to x_print_expansions() + - preserves the emacs mode behaviour + + Why: in vi mode one can use the expansion number to + complete the word, but w/o numbers printed you + have to *count* expansions with your eyes to + find out the number. Stupid, huh? +--- + edit.c | 7 +++++-- + edit.h | 2 +- + emacs.c | 4 ++-- + vi.c | 4 ++-- + 4 files changed, 10 insertions(+), 7 deletions(-) + +diff --git edit.c edit.c +index 0b1ff7d..9cdcc6d 100644 +--- edit.c ++++ edit.c +@@ -292,7 +292,7 @@ static void glob_path(int flags, const char *pat, XPtrV *wp, + const char *path); + + void +-x_print_expansions(int nwords, char *const *words, int is_command) ++x_print_expansions(int nwords, char *const *words, int is_command, int menu) + { + int use_copy = 0; + int prefix_len; +@@ -330,7 +330,10 @@ x_print_expansions(int nwords, char *const *words, int is_command) + */ + x_putc('\r'); + x_putc('\n'); +- pr_list(use_copy ? (char **) XPptrv(l) : words); ++ if (menu) ++ pr_menu(use_copy ? (char **) XPptrv(l) : words); ++ else ++ pr_list(use_copy ? (char **) XPptrv(l) : words); + + if (use_copy) + XPfree(l); /* not x_free_words() */ +diff --git edit.h edit.h +index 37ccf28..258affe 100644 +--- edit.h ++++ edit.h +@@ -52,7 +52,7 @@ void x_puts(const char *); + bool x_mode(bool); + int promptlen(const char *, const char **); + int x_do_comment(char *, int, int *); +-void x_print_expansions(int, char *const *, int); ++void x_print_expansions(int, char *const *, int, int); + int x_cf_glob(int, const char *, int, int, int *, int *, char ***, int *); + int x_longest_prefix(int , char *const *); + int x_basename(const char *, const char *); +diff --git emacs.c emacs.c +index 0bfda96..3b2d083 100644 +--- emacs.c ++++ emacs.c +@@ -1684,7 +1684,7 @@ do_complete(int flags, /* XCF_{COMMAND,FILE,COMMAND_FILE} */ + } + + if (type == CT_LIST) { +- x_print_expansions(nwords, words, is_command); ++ x_print_expansions(nwords, words, is_command, 0); + x_redraw(0); + x_free_words(nwords, words); + return; +@@ -1707,7 +1707,7 @@ do_complete(int flags, /* XCF_{COMMAND,FILE,COMMAND_FILE} */ + } + + if (type == CT_COMPLIST && !completed) { +- x_print_expansions(nwords, words, is_command); ++ x_print_expansions(nwords, words, is_command, 0); + completed = 1; + } + +diff --git vi.c vi.c +index 6eb5d8c..95d192c 100644 +--- vi.c ++++ vi.c +@@ -1990,7 +1990,7 @@ complete_word(int command, int count, int flags) + count--; + if (count >= nwords) { + vi_error(); +- x_print_expansions(nwords, words, is_command); ++ x_print_expansions(nwords, words, is_command, 1); + x_free_words(nwords, words); + redraw_line(0); + return -1; +@@ -2064,7 +2064,7 @@ print_expansions(struct edstate *e, int flags) + vi_error(); + return -1; + } +- x_print_expansions(nwords, words, is_command); ++ x_print_expansions(nwords, words, is_command, 1); + x_free_words(nwords, words); + redraw_line(0); + return 0; +-- +1.7.5 + |