From edf6a951ee3c84c9b24cd285383f7dac764edbb7 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 19 May 2015 22:13:55 -0700 Subject: [PATCH 1/5] Unescape the token returned by builtin_commandline Fixes #2075 --- builtin_commandline.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builtin_commandline.cpp b/builtin_commandline.cpp index 339cb0d14..01bc123ac 100644 --- a/builtin_commandline.cpp +++ b/builtin_commandline.cpp @@ -206,7 +206,9 @@ static void write_part(const wchar_t *begin, { case TOK_STRING: { - out.append(escape_string(tok_last(&tok), UNESCAPE_INCOMPLETE)); + wcstring tmp = tok_last(&tok); + unescape_string_in_place(&tmp, UNESCAPE_INCOMPLETE); + out.append(tmp); out.push_back(L'\n'); break; } @@ -230,8 +232,9 @@ static void write_part(const wchar_t *begin, } // debug( 0, L"woot2 %ls -> %ls", buff, esc ); - - stdout_buffer.append(begin, end - begin); + wcstring tmp = wcstring(begin, end - begin); + unescape_string_in_place(&tmp, UNESCAPE_INCOMPLETE); + stdout_buffer.append(tmp); stdout_buffer.append(L"\n"); } From c0cf25cf0b28969dd9ef821f7952f42783ed6720 Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 22 May 2015 09:48:39 +0800 Subject: [PATCH 2/5] abbr: rename --remove to --erase for consistency with other fish commands Closes #2071. --- doc_src/abbr.txt | 8 ++++---- share/completions/abbr.fish | 2 +- share/functions/abbr.fish | 6 +++--- share/tools/web_config/webconfig.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc_src/abbr.txt b/doc_src/abbr.txt index 0c3dc37a3..a32592d88 100644 --- a/doc_src/abbr.txt +++ b/doc_src/abbr.txt @@ -5,7 +5,7 @@ abbr -a word="phrase" abbr -s abbr -l -abbr -r word +abbr -e word \endfish \subsection abbr-description Description @@ -24,7 +24,7 @@ The following parameters are available: - `-l` or `--list` Lists all abbreviated words. -- `-r WORD` or `--remove WORD` Remove the abbreviation WORD. +- `-e WORD` or `--erase WORD` Erase the abbreviation WORD. \subsection abbr-example Examples @@ -34,9 +34,9 @@ abbr -a gco git checkout Add a new abbreviation where `gco` will be replaced with `git checkout`. \fish -abbr -r gco +abbr -e gco \endfish -Remove the `gco` abbreviation. +Erase the `gco` abbreviation. \fish ssh another_host abbr -s | source diff --git a/share/completions/abbr.fish b/share/completions/abbr.fish index 6671ecd68..3dcac341a 100644 --- a/share/completions/abbr.fish +++ b/share/completions/abbr.fish @@ -1,5 +1,5 @@ complete -c abbr -f -s a -l add -d 'Add abbreviation' -complete -c abbr -s r -l remove -d 'Remove abbreviation' -xa '(abbr -l)' +complete -c abbr -s e -l erase -d 'Erase abbreviation' -xa '(abbr -l)' complete -c abbr -f -s s -l show -d 'Print all abbreviations' complete -c abbr -f -s l -l list -d 'Print all abbreviation names' complete -c abbr -f -s h -l help -d 'Help' diff --git a/share/functions/abbr.fish b/share/functions/abbr.fish index 7669b8fd1..dd67b898f 100644 --- a/share/functions/abbr.fish +++ b/share/functions/abbr.fish @@ -26,8 +26,8 @@ function abbr --description "Manage abbreviations" case '-a' '--add' set new_mode add set needs_arg coalesce - case '-r' '--remove' - set new_mode remove + case '-e' '--erase' + set new_mode erase set needs_arg single case '-l' '--list' set new_mode list @@ -91,7 +91,7 @@ function abbr --description "Manage abbreviations" set fish_user_abbreviations $fish_user_abbreviations $mode_arg return 0 - case 'remove' + case 'erase' set -l key __fish_abbr_parse_entry $mode_arg key if set -l idx (__fish_abbr_get_by_key $key) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 5438a43e8..d65c86f89 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -702,7 +702,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): return result def do_remove_abbreviation(self, abbreviation): - out, err = run_fish_cmd('abbr -r %s' % abbreviation['word']) + out, err = run_fish_cmd('abbr -e %s' % abbreviation['word']) if out or err: return err else: From 6c53862ff1cc7ada37f76a2fdabf85f3c3ba40d9 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 1 Jun 2015 19:20:25 -0700 Subject: [PATCH 3/5] Suppress uvar error messages due to permissions or file not found su does not reset XDG_RUNTIME_DIR, which means that XDG_RUNTIME_DIR may point to directories that the user does not have permission to access. Similarly there is no guarantee that XDG_RUNTIME_DIR points to a directory that actually exists. Rather than try to handle these issues, we simply ignore them, effectively disabling realtime uvar notifications. Fixes #1955. --- env_universal_common.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/env_universal_common.cpp b/env_universal_common.cpp index a8d45bcd9..f90cc82bf 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -1376,7 +1376,13 @@ class universal_notifier_named_pipe_t : public universal_notifier_t { // Maybe open failed, maybe mkfifo failed int err = errno; - report_error(err, L"Unable to make or open a FIFO for universal variables with path '%ls'", vars_path.c_str()); + // We explicitly do NOT report an error for ENOENT or EACCESS + // This works around #1955, where $XDG_RUNTIME_DIR may get a bogus value under suc + if (err != ENOENT && err != EPERM) + { + report_error(err, L"Unable to make or open a FIFO for universal variables with path '%ls'", vars_path.c_str()); + } + pipe_fd= -1; } else { From 79a696179367ceb0ab653dc1ac5bdb0cc7156e93 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 4 Jun 2015 13:17:33 -0700 Subject: [PATCH 4/5] Add some simple documentation for fish_vi_mode --- doc_src/fish_vi_mode.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc_src/fish_vi_mode.txt diff --git a/doc_src/fish_vi_mode.txt b/doc_src/fish_vi_mode.txt new file mode 100644 index 000000000..b2ea45834 --- /dev/null +++ b/doc_src/fish_vi_mode.txt @@ -0,0 +1,10 @@ +408-600-6421\section fish_vi_mode fish_vi_mode - Enable vi mode + +\subsection fish_vi_mode-synopsis Synopsis +\fish{synopsis} +fish_vi_mode +\endfish + +\subsection fish_vi_mode-description Description + +`fish_vi_mode` enters a vi-like command editing mode. To always start in vi mode, add `fish_vi_mode` to your `config.fish` file. From b6b6de330463db1b79c9c7a67efd6d671b9b9de3 Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 5 Jun 2015 14:01:43 +0800 Subject: [PATCH 5/5] vi bindings: clear commandline with Ctrl-C Closes #2077. --- share/functions/fish_vi_key_bindings.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 2140cf687..ba64f8282 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -191,7 +191,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -M insert \cb backward-word bind -M insert \cf forward-word - bind -M insert -m default \cc backward-char force-repaint + bind -M insert \cc 'commandline ""' bind -M insert -m default \e backward-char force-repaint bind -M insert \cd exit