mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 05:31:14 -03:00
Fix a wrong path to fish_indent on OpenBSD
If fish is invoked as
execve("/bin/fish", "fish")
on OpenBSD, "status fish-path" will output "fish". As a result,
our wrapper for fish_indent tries to execute "./fish" if it exists.
We actually no longer need to call any executable, since "fish_indent"
is available as builtin now.
Stop using the wrapper, fixing the OpenBSD issue.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# TODO(embed-data) Remove this after that has been rolled out (on-by-default).
|
||||
|
||||
# localization: skip(private)
|
||||
set -l dir "$(path dirname -- (status fish-path))"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ function edit_command_buffer --description 'Edit the command buffer in an extern
|
||||
set -l editor (__fish_anyeditor)
|
||||
or return 1
|
||||
|
||||
set -l indented_lines (commandline -b | __fish_indent --only-indent)
|
||||
set -l indented_lines (commandline -b | fish_indent --only-indent)
|
||||
string join -- \n $indented_lines >$f
|
||||
set -l offset (commandline --cursor)
|
||||
# compute cursor line/column
|
||||
@@ -83,7 +83,7 @@ function edit_command_buffer --description 'Edit the command buffer in an extern
|
||||
$editor
|
||||
|
||||
set -l raw_lines (command cat $f)
|
||||
set -l unindented_lines (string join -- \n $raw_lines | __fish_indent --only-unindent)
|
||||
set -l unindented_lines (string join -- \n $raw_lines | fish_indent --only-unindent)
|
||||
|
||||
# Here we're checking the exit status of the editor.
|
||||
if test $status -eq 0 -a -s $f
|
||||
|
||||
@@ -3,8 +3,8 @@ function fish_clipboard_copy
|
||||
if isatty stdin
|
||||
# Copy the current selection, or the entire commandline if that is empty.
|
||||
# Don't use `string collect -N` here - `commandline` adds a newline.
|
||||
set cmdline (commandline --current-selection | __fish_indent --only-indent | string collect)
|
||||
test -n "$cmdline"; or set cmdline (commandline | __fish_indent --only-indent | string collect)
|
||||
set cmdline (commandline --current-selection | fish_indent --only-indent | string collect)
|
||||
test -n "$cmdline"; or set cmdline (commandline | fish_indent --only-indent | string collect)
|
||||
else
|
||||
# Read from stdin
|
||||
while read -lz line
|
||||
|
||||
@@ -45,12 +45,12 @@ function funced --description 'Edit function definition'
|
||||
|
||||
if test "$editor" = fish
|
||||
if functions -q -- $funcname
|
||||
functions --no-details -- $funcname | __fish_indent --only-unindent | __fish_indent --no-indent | read -z init
|
||||
functions --no-details -- $funcname | fish_indent --only-unindent | fish_indent --no-indent | read -z init
|
||||
end
|
||||
|
||||
set -l prompt 'printf "%s%s%s> " (set_color green) $funcname (set_color normal)'
|
||||
if read -p $prompt -c "$init" --shell cmd
|
||||
echo -n $cmd | __fish_indent --only-unindent | read -lz cmd
|
||||
echo -n $cmd | fish_indent --only-unindent | read -lz cmd
|
||||
eval "$cmd"
|
||||
end
|
||||
if set -q _flag_save
|
||||
|
||||
Reference in New Issue
Block a user