diff options
Diffstat (limited to 'shells/bash/files')
-rw-r--r-- | shells/bash/files/extrapatch-colonbreakswords | 176 | ||||
-rw-r--r-- | shells/bash/files/patch-lib_readline_display.c | 10 |
2 files changed, 5 insertions, 181 deletions
diff --git a/shells/bash/files/extrapatch-colonbreakswords b/shells/bash/files/extrapatch-colonbreakswords deleted file mode 100644 index 7ec901e14c80..000000000000 --- a/shells/bash/files/extrapatch-colonbreakswords +++ /dev/null @@ -1,176 +0,0 @@ ---- bashline.c.orig 2014-03-02 13:26:23.000000000 -0500 -+++ bashline.c 2014-03-02 13:30:09.000000000 -0500 -@@ -255,6 +255,11 @@ - host list. */ - int perform_hostname_completion = 1; - -+/* If non-zero, we do hostname completion, breaking words at `@' and -+ trying to complete the stuff after the `@' from our own internal -+ host list. */ -+int colon_is_wordbreak = 1; -+ - /* If non-zero, we don't do command completion on an empty line. */ - int no_empty_command_completion; - -@@ -284,7 +289,8 @@ - - static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:"; - static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:"; --/* )) */ -+static char *bash_nocolon_word_break_characters = " \t\n\"'@><=;|&("; -+/* ))) */ - - static const char *default_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~"; /*}*/ - static char *custom_filename_quote_characters = 0; -@@ -403,6 +409,80 @@ - return (old_value); - } - -+/* When this function returns, rl_completer_word_break_characters points to -+ dynamically allocated memory. */ -+int -+enable_colon_wordbreak (on_or_off) -+ int on_or_off; -+{ -+ int old_value; -+ char *at, *nv, *nval; -+ -+ old_value = colon_is_wordbreak; -+ -+ if (on_or_off) -+ { -+ colon_is_wordbreak = 1; -+ rl_filename_quote_characters = default_filename_quote_characters; -+ } -+ else -+ { -+ colon_is_wordbreak = 0; -+ rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!{~"; /*}*/ -+ } -+ -+ /* Now we need to figure out how to appropriately modify and assign -+ rl_completer_word_break_characters depending on whether we want -+ the colon to be a word break or not. */ -+ -+ /* If this is the first time this has been called -+ (bash_readline_initialized == 0), use the sames values as before, but -+ allocate new memory for rl_completer_word_break_characters. */ -+ -+ if (bash_readline_initialized == 0 && -+ (rl_completer_word_break_characters == 0 || -+ rl_completer_word_break_characters == rl_basic_word_break_characters)) -+ { -+ if (on_or_off) -+ rl_completer_word_break_characters = savestring (bash_completer_word_break_characters); -+ else -+ rl_completer_word_break_characters = savestring (bash_nocolon_word_break_characters); -+ } -+ else -+ { -+ /* See if we have anything to do. */ -+ at = strchr (rl_completer_word_break_characters, ':'); -+ if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0)) -+ return old_value; -+ -+ /* We have something to do. Do it. */ -+ nval = (char *)xmalloc (strlen (rl_completer_word_break_characters) + 1 + on_or_off); -+ -+ if (on_or_off == 0) -+ { -+ /* Turn it off -- just remove `:' from word break chars. We want -+ to remove all occurrences of `:' from the char list, so we loop -+ rather than just copy the rest of the list over AT. */ -+ for (nv = nval, at = rl_completer_word_break_characters; *at; ) -+ if (*at != ':') -+ *nv++ = *at++; -+ else -+ at++; -+ *nv = '\0'; -+ } -+ else -+ { -+ nval[0] = ':'; -+ strcpy (nval + 1, rl_completer_word_break_characters); -+ } -+ -+ free (rl_completer_word_break_characters); -+ rl_completer_word_break_characters = nval; -+ } -+ -+ return (old_value); -+} -+ - /* Called once from parse.y if we are going to use readline. */ - void - initialize_readline () -@@ -573,8 +653,13 @@ - completion is enabled. */ - enable_hostname_completion (perform_hostname_completion); - -+ /* This sets rl_completer_word_break_characters and rl_filename_quote_characters -+ to the appropriate values, depending on whether or not a colon -+ should break completion words or not. */ -+ enable_colon_wordbreak (colon_is_wordbreak); -+ - /* characters that need to be quoted when appearing in filenames. */ -- rl_filename_quote_characters = default_filename_quote_characters; -+// rl_filename_quote_characters = default_filename_quote_characters; - set_filename_bstab (rl_filename_quote_characters); - - rl_filename_quoting_function = bash_quote_filename; ---- builtins/shopt.def.orig 2014-03-02 13:30:44.000000000 -0500 -+++ builtins/shopt.def 2014-03-02 13:31:38.000000000 -0500 -@@ -103,6 +103,8 @@ - extern int complete_fullquote; - - extern int enable_hostname_completion __P((int)); -+extern int colon_is_wordbreak; -+extern int enable_colon_wordbreak __P((int)); - #endif - - #if defined (PROGRAMMABLE_COMPLETION) -@@ -166,6 +168,9 @@ - { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand }, - { "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL }, - #endif -+#if defined (READLINE) -+ { "colonbreakswords", &colon_is_wordbreak, enable_colon_wordbreak }, -+#endif - { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL }, - { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL }, - { "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL }, ---- doc/bash.1.orig 2014-03-02 13:32:14.000000000 -0500 -+++ doc/bash.1 2014-03-02 13:32:40.000000000 -0500 -@@ -9252,6 +9252,18 @@ - command in the same history entry. This allows - easy re-editing of multi-line commands. - .TP 8 -+.B colonbreakswords -+If set, and -+.B readline -+is being used, \fBbash\fP will treat \fB:\fP as -+separating word being completed (see -+.B Completing -+under -+.SM -+.B READLINE -+above). -+This is enabled by default. -+.TP 8 - .B compat31 - If set, - .B bash ---- doc/bashref.texi.orig 2014-03-02 13:33:17.000000000 -0500 -+++ doc/bashref.texi 2014-03-02 13:33:44.000000000 -0500 -@@ -4937,6 +4937,11 @@ - command in the same history entry. This allows - easy re-editing of multi-line commands. - -+@item colonbreakswords -+If set, and Readline is being used, Bash will treat @samp{:} as -+separating word being completed (@pxref{Commands For Completion}). -+This option is enabled by default. -+ - @item compat31 - If set, Bash - changes its behavior to that of version 3.1 with respect to quoted diff --git a/shells/bash/files/patch-lib_readline_display.c b/shells/bash/files/patch-lib_readline_display.c index f057294bc669..b69b08410b1a 100644 --- a/shells/bash/files/patch-lib_readline_display.c +++ b/shells/bash/files/patch-lib_readline_display.c @@ -1,9 +1,9 @@ ---- lib/readline/display.c.orig 2016-07-28 18:49:33 UTC +--- lib/readline/display.c.orig 2018-10-01 01:37:48 UTC +++ lib/readline/display.c -@@ -743,7 +743,10 @@ rl_redisplay () - inv_lbreaks[newlines = 0] = 0; - /* lpos is a physical cursor position, so it needs to be adjusted by the - number of invisible characters in the prompt, per line */ +@@ -837,7 +837,10 @@ rl_redisplay (void) + the line breaks in the prompt string in expand_prompt, taking invisible + characters into account, and if lpos exceeds the screen width, we copy + the data in the loop below. */ + if (local_prompt) lpos = prompt_physical_chars + modmark; + else |