From bb29f9f990e5f11329a4cfd8efefa8cca5904b10 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 22 Jun 2017 22:24:24 -0700 Subject: [PATCH] replace __fish_urlencode with `string escape` We now have a builtin that can do URL escaping so use it. I can't find any uses of our private `__fish_urlencode` function in any Oh-My-Fish or Fisherman code so remove it. --- doc_src/string.txt | 2 +- po/de.po | 5 ---- po/en.po | 4 --- po/fr.po | 4 --- po/nb.po | 4 --- po/nn.po | 4 --- po/pl.po | 4 --- po/pt_BR.po | 5 ---- po/sv.po | 4 --- po/zh_CN.po | 4 --- .../functions/__fish_config_interactive.fish | 2 +- share/functions/__fish_urlencode.fish | 26 ------------------- 12 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 share/functions/__fish_urlencode.fish diff --git a/doc_src/string.txt b/doc_src/string.txt index 4cb805c74..d4f91a874 100644 --- a/doc_src/string.txt +++ b/doc_src/string.txt @@ -167,7 +167,7 @@ In general, special characters are special by default, so `a+` matches one or mo \endfish \fish{cli-dark} ->_ string escape --style=var 'a1 b2'\u6161 +>_ string escape --style=var 'a1 b2'\\u6161 a1_20b2__c_E6_85_A1 \endfish diff --git a/po/de.po b/po/de.po index aa01c682b..dd1884bd2 100644 --- a/po/de.po +++ b/po/de.po @@ -61324,11 +61324,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "Befehlsspezifische Erweiterungen bearbeiten" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -#, fuzzy -msgid "URL-encode stdin" -msgstr "Standardeingabe umbenennen" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 #, fuzzy msgid "Test if a non-switch argument has been given in the current commandline" diff --git a/po/en.po b/po/en.po index d46c3cdbd..98c05d543 100644 --- a/po/en.po +++ b/po/en.po @@ -8114,10 +8114,6 @@ msgstr "Show current path" msgid "Test if the token under the cursor matches the specified wildcard" msgstr "Test if the token under the cursor matches the specified wildcard" -#: share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "URL-encode stdin" - #: share/functions/__terlar_git_prompt.fish:23 msgid "Write out the git prompt" msgstr "Write out the git prompt" diff --git a/po/fr.po b/po/fr.po index 41178ebeb..4246a2f06 100644 --- a/po/fr.po +++ b/po/fr.po @@ -60024,10 +60024,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "Éditer les complétions spécifiques aux commandes" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 #, fuzzy msgid "Test if a non-switch argument has been given in the current commandline" diff --git a/po/nb.po b/po/nb.po index f7b186b4f..c00a8bb5f 100644 --- a/po/nb.po +++ b/po/nb.po @@ -56722,10 +56722,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 msgid "Test if a non-switch argument has been given in the current commandline" msgstr "" diff --git a/po/nn.po b/po/nn.po index bb6f0bfa0..d6ebbe0e9 100644 --- a/po/nn.po +++ b/po/nn.po @@ -56722,10 +56722,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 msgid "Test if a non-switch argument has been given in the current commandline" msgstr "" diff --git a/po/pl.po b/po/pl.po index da16fd43c..18ccaef90 100644 --- a/po/pl.po +++ b/po/pl.po @@ -57143,10 +57143,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "Edytuj sugestie do określonej komendy" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 msgid "Test if a non-switch argument has been given in the current commandline" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 66f30ac5d..fd9d1233d 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -61774,11 +61774,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "Edit command specific completions" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -#, fuzzy -msgid "URL-encode stdin" -msgstr "Rename stdin" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 #, fuzzy msgid "Test if a non-switch argument has been given in the current commandline" diff --git a/po/sv.po b/po/sv.po index 5ed37d0de..cb0e93c88 100644 --- a/po/sv.po +++ b/po/sv.po @@ -53577,10 +53577,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 msgid "Test if a non-switch argument has been given in the current commandline" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 8b85f2e17..b67a05fe6 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -57099,10 +57099,6 @@ msgstr "" msgid "Update man-page based completions" msgstr "编辑命令相关的补全" -#: /tmp/fish/implicit/share/functions/__fish_urlencode.fish:1 -msgid "URL-encode stdin" -msgstr "" - #: /tmp/fish/implicit/share/functions/__fish_use_subcommand.fish:1 msgid "Test if a non-switch argument has been given in the current commandline" msgstr "" diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index cf34936e0..0b7099270 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -262,7 +262,7 @@ function __fish_config_interactive -d "Initializations that should be performed status --is-command-substitution or test -n "$INSIDE_EMACS" and return - printf \e\]7\;file://\%s\%s\a (hostname) (echo -n $PWD | __fish_urlencode) + printf \e\]7\;file://\%s\%s\a (hostname) (string escape --style=url $PWD) end __update_cwd_osc # Run once because we might have already inherited a PWD from an old tab end diff --git a/share/functions/__fish_urlencode.fish b/share/functions/__fish_urlencode.fish deleted file mode 100644 index 0e336813e..000000000 --- a/share/functions/__fish_urlencode.fish +++ /dev/null @@ -1,26 +0,0 @@ -function __fish_urlencode --description "URL-encode stdin" - set -l join '' - set -l chars - # Set locale to C and IFS to "" in order to split a line into bytes. - while begin - set -lx LC_ALL C - set -lx IFS '' - read -az chars - end - printf '%s' $join - # chomp off a trailing newline - if test "$chars[-1]" = \n - set -e chars[-1] - set join '%0A%00' - else - set join '%00' - end - for c in $chars - if string match -q -r '[/._~A-Za-z0-9-]' $c - printf '%s' $c - else - printf '%%%02X' "'$c" - end - end - end -end