From 431589a16ac0096a146a7876baff26342ebe6094 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Fri, 1 Jul 2016 00:00:53 -0700 Subject: [PATCH] Use fish -c string ... as the `string` fallback. We can again drop the prompt_pwd check. --- share/config.fish | 4 +--- share/functions/prompt_pwd.fish | 5 ----- share/functions/string.fish | 8 ++++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/share/config.fish b/share/config.fish index 92c5d4078..2090b4421 100644 --- a/share/config.fish +++ b/share/config.fish @@ -26,8 +26,6 @@ if status --is-interactive # When executed on fish 2.2.0, the `else' block after this would # force on 24-bit mode due to changes to in test behavior. # These "XXX nostring" hacks were added for 2.3.1 - - # Let's explain to the user what's going on. set_color --bold echo "You appear to be trying to launch an old fish binary with newer scripts " echo "installed into" (set_color --underline)"$__fish_datadir" @@ -37,7 +35,7 @@ if status --is-interactive echo "You may need to uninstall and reinstall fish!" set_color normal # Remove this code when we've made it safer to upgrade fish. - else + else # Enable truecolor/24-bit support for select terminals if not set -q NVIM_LISTEN_ADDRESS # (Neovim will swallow the 24bit sequences, rendering text white) and begin diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index 4464d75d0..71dfc461e 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -5,11 +5,6 @@ function prompt_pwd --description "Print the current working directory, shortene __fish_print_help prompt_pwd return 0 end - if set -q $__is_launched_without_string - # There is no `string' builtin - do something sensible. XXX nostring - echo $PWD - return 0 - end # This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it set -q fish_prompt_pwd_dir_length diff --git a/share/functions/string.fish b/share/functions/string.fish index c86ec4ce8..8e4b17c5f 100644 --- a/share/functions/string.fish +++ b/share/functions/string.fish @@ -1,5 +1,5 @@ +# XXX nostring if not contains string (builtin -n) - # XXX nostring function string if not set -q __is_launched_without_string if status --is-interactive @@ -14,6 +14,10 @@ if not contains string (builtin -n) set -g __is_launched_without_string 1 end end - return 127 + # We hope that in $__fish_bin_path is a newer fish that can do `string` for us. + + set fish_user_paths $__fish_bin_dir $fish_user_paths + set string_cmd string \'$argv\' + fish -c "$string_cmd" end end