Compare commits

..

24 Commits
3.5.0 ... 3.5.1

Author SHA1 Message Date
David Adam
62063e24ca Release 3.5.1 2022-07-20 18:15:43 +08:00
David Adam
0f84b9fafb CHANGELOG: work on 3.5.1 2022-07-16 21:55:28 +08:00
Bagohart
e7e4d8415b added tab completions for choose
(cherry picked from commit ce6b122f7f)
2022-07-16 21:41:37 +08:00
Bagohart
9cdaf1ec72 added tab completions for navi
(cherry picked from commit 824ee5d70b)
2022-07-16 21:40:30 +08:00
David Adam
e8cc3803ca CHANGELOG: work on 3.5.1 2022-07-14 22:25:42 +08:00
Israel Chauca Fuentes
a4f5b9eb54 Add completion for the "expect" command
(cherry picked from commit 9e43e74723)
2022-07-14 13:26:08 +08:00
Alexander M
c5240033df Fix long descriptions in gdb.fish
Work on #6981

(cherry picked from commit 8d57bc6a9a)
2022-07-14 13:26:01 +08:00
Fabian Boehm
303bf2cfcb completions/git: Use __fish_git
That's the one that silences stderr!

(cherry picked from commit 8082f8c056)
2022-07-14 13:25:51 +08:00
Kid
d3f4b829ba file completion nuances on macOS
(cherry picked from commit e6505d1c30)
2022-07-14 13:25:41 +08:00
Fabian Boehm
4c2ce4b931 Add error for EBADARCH
That's apparently errno 86 on macOS, and it's triggered when the
architecture is wrong.

I'll leave other macOS errors to the macOS users.

See #9052.

(cherry picked from commit 60f87ef3be)
2022-07-14 13:25:32 +08:00
Fabian Boehm
98838ac429 Fix special readline functions after and/or
Here we needed to handle self-insert immediately, but we ended up
returning it.

Fixes #9051

(cherry picked from commit d920610f96)
2022-07-14 12:43:12 +08:00
Fabian Boehm
e67b6c1f00 history: Refuse to merge in private mode
It makes *no* sense.

Fixes #9050.

(cherry picked from commit bd7934ccbf)
2022-07-13 23:13:33 +08:00
Fabian Boehm
1008b729a7 fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.

(cherry picked from commit 80fe0a7fcb)
2022-07-13 23:12:02 +08:00
Rocka
bc30e15774 completions: add qdbus completion
(cherry picked from commit c588bd5c5c)
2022-07-13 23:10:31 +08:00
NextAlone
1c3a8e0e11 feat: completion for reflector (#9027)
(cherry picked from commit 5642499dc2)
2022-07-13 22:21:39 +08:00
mhmdanas
970f32d87f Prioritize APKs for adb install
(cherry picked from commit 9f19ab1fba)
2022-07-13 22:20:31 +08:00
exploide
95582ef76b scp completions: added new options
(cherry picked from commit 459bbe208d)
2022-07-13 22:20:17 +08:00
Fabian Boehm
89a30841f2 printf: Print special error for invalid octal numbers
(tbh these were always a mistake)

See #9035

(cherry picked from commit 13a9f6b64e)
2022-07-13 22:18:59 +08:00
ridiculousfish
9397ede963 Clear signals after running initial commands
If you run an initial command via `fish -c`, and that command is
cancelled e.g. via control-C, then ensure that the cancellation signal
is cleared before running config files.

Fixes #9024

(cherry picked from commit 137a4ecdf5)
2022-07-13 22:18:43 +08:00
Fabian Boehm
6e9590b220 Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981

(cherry picked from commit b4a3b9982c)
2022-07-13 22:18:12 +08:00
Fabian Boehm
687a16b260 status fish-path: Remove "(deleted)" suffix
Fixes #9018.

(cherry picked from commit 6e0653af93)
2022-07-13 22:17:33 +08:00
David Adam
a396fdc907 CHANGELOG: work on 3.5.1 2022-07-13 21:42:18 +08:00
Guy Bolton King
47d45f49e4 Remove invalid trailing period in CSI u shift-space binding
(cherry picked from commit 1f130fbfe1)
2022-07-04 20:08:30 +02:00
Johannes Altmanninger
a6898467ab Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.

(cherry picked from commit fee5a9125a)
2022-07-04 20:01:11 +02:00
24 changed files with 294 additions and 70 deletions

View File

@@ -1,3 +1,33 @@
fish 3.5.1 (released July 20, 2022)
===================================
This release of fish introduces the following small enhancements:
- Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`).
- ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`).
- ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`).
- The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`).
- Added completions for:
- ``choose`` (:issue:`9065`)
- ``expect`` (:issue:`9060`)
- ``navi`` (:issue:`9064`)
- ``qdbus`` (:issue:`9031`)
- ``reflector`` (:issue:`9027`)
- Improvements to some completions.
This release also fixes a number of problems identified in fish 3.5.0.
- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`).
- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`).
- ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`).
- Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`).
- The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (:issue:`9044`).
- Using special input functions in bindings, in combination with ``and``/``or`` conditionals, no longer crashes (:issue:`9051`).
--------------
fish 3.5.0 (released June 16, 2022)
===================================

View File

@@ -139,6 +139,7 @@ complete -n '__fish_seen_subcommand_from install' -c adb -s s -d 'Install on SD
complete -n '__fish_seen_subcommand_from install' -c adb -l algo -d 'Algorithm name'
complete -n '__fish_seen_subcommand_from install' -c adb -l key -d 'Hex-encoded key'
complete -n '__fish_seen_subcommand_from install' -c adb -l iv -d 'Hex-encoded iv'
complete -n '__fish_seen_subcommand_from install' -c adb -ka '(__fish_complete_suffix .apk)'
# uninstall
complete -n '__fish_seen_subcommand_from uninstall' -c adb -s k -d 'Keep the data and cache directories'

View File

@@ -0,0 +1,15 @@
complete choose --no-files
# flags:
complete choose -s c -l character-wise -d "Choose fields by character number"
complete choose -s d -l debug -d "Activate debug mode"
complete choose -s x -l exclusive -d "Use exclusive ranges, similar to array indexing in many programming languages"
complete choose -x -s h -l help -d "Prints help information"
complete choose -s n -l non-greedy -d "Use non-greedy field separators"
complete choose -l one-indexed -d "Index from 1 instead of 0"
complete choose -s V -l version -d "Prints version information"
# options:
complete choose -x -s f -l field-separator -d "Specify field separator other than whitespace, using Rust `regex` syntax"
complete choose -r -s i -l input -d "Specify input file"
complete choose -x -s o -l output-field-separator -d "Specify output field separator"

View File

@@ -0,0 +1,9 @@
complete -c expect -s c -r -d "execute command"
complete -c expect -s d -n "__fish_not_contain_opt -s d" -d "diagnostic output"
complete -c expect -s D -x -r -a "0 1" -n "__fish_not_contain_opt -s D" -d "debug value"
complete -c expect -s f -r -d "script path"
complete -c expect -s i -n "__fish_not_contain_opt -s i" -d "interactive mode"
complete -c expect -s v -n "__fish_not_contain_opt -s v" -d "print version"
complete -c expect -s N -n "__fish_not_contain_opt -s N" -d "skip global rc"
complete -c expect -s n -n "__fish_not_contain_opt -s n" -d "skip user rc"
complete -c expect -s b -n "__fish_not_contain_opt -s b" -d "read line by line"

View File

@@ -4,7 +4,14 @@ complete -c file -s b -l brief -d 'Do not prepend filenames to output lines'
complete -c file -s c -l checking-printout -d 'Print the parsed form of the magic file'
complete -c file -s C -l compile -d 'Write an output file containing a pre-parsed version of file'
complete -c file -s h -l no-dereference -d 'Do not follow symlinks'
complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings'
if test (uname) = Darwin
complete -c file -s i -d 'Do not classify regular file contents'
complete -c file -s I -l mime -d 'Output mime type strings instead human readable strings'
else
complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings'
end
complete -c file -s k -l keep-going -d 'Don\'t stop at the first match'
complete -c file -s L -l dereference -d 'Follow symlinks'
complete -c file -s n -l no-buffer -d 'Flush stdout after checking each file'

View File

@@ -6,19 +6,19 @@
#
complete -c gdb -o help -s h -d 'List all options, with brief explanations'
complete -c gdb -o symbols -s s -d 'Read symbol table from file file' -r
complete -c gdb -o symbols -s s -d 'Read symbol table from <file>' -r
complete -c gdb -o write -d 'Enable writing into executable and core files'
complete -c gdb -o exec -s e -d 'Use file file as the executable file to execute when appropri ate, and for examining pure data in conjunction with a core dump' -r
complete -c gdb -o se -d 'Read symbol table from file file and use it as the executable file' -r
complete -c gdb -o core -s c -d 'Use file file as a core dump to examine' -r
complete -c gdb -o command -s x -d 'Execute GDB commands from file file' -r
complete -c gdb -o directory -s d -d 'Add directory to the path to search for source files' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o exec -s e -d 'Set executable' -r
complete -c gdb -o se -d 'Read symbol table from <file> and execute it' -r
complete -c gdb -o core -s c -d 'Use <file> as a core dump to examine' -r
complete -c gdb -o command -s x -d 'Execute GDB commands from <file>' -r
complete -c gdb -o directory -s d -d 'Add directory with source files' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o nx -s n -d 'Do not execute commands from any .gdbinit files'
complete -c gdb -o quiet -s q -d Quiet
complete -c gdb -o batch -d 'Run in batch mode'
complete -c gdb -o cd -d 'Run GDB using directory as its working directory, instead of the current directory' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o fullname -s f -d 'Emacs sets this option when it runs GDB as a subprocess'
complete -c gdb -s b -d 'Bps Set the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging'
complete -c gdb -o tty -d 'Run using device for your programs standard input and output' -r
complete -c gdb -l args -d 'Pass arguments after the program name to the program when it is run'
complete -c gdb -o cd -d 'Set GDB\'s working directory' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o fullname -s f -d 'Used by Emacs'
complete -c gdb -s b -d 'Set throughput in bps for remote debugging'
complete -c gdb -o tty -d 'Set device for the program\'s stdin/stdout' -r
complete -c gdb -l args -d 'Pass arguments to the program after its name'
complete -c gdb -o tui -d 'Run GDB using a text (console) user interface'

View File

@@ -507,12 +507,12 @@ function __fish_git_rev_files
# List files in $rev's index, skipping the "tree ..." header, but appending
# the parent path, which git does not include in the output (and fish requires)
printf "$path%s\n" (git show $rev:$path | sed '1,2d')
printf "$path%s\n" (__fish_git show $rev:$path | sed '1,2d')
end
# Provides __fish_git_rev_files completions for the current token
function __fish_git_complete_rev_files
set -l split (string split -m 1 ":" (commandline -ot))
set -l split (string split -m 1 ":" -- (commandline -ot))
set -l rev $split[1]
set -l path $split[2]
@@ -563,6 +563,25 @@ function __fish_git_ranges
end
end
function __fish_git_needs_command
# Figure out if the current invocation already has a command.
set -l cmd (commandline -opc)
set -e cmd[1]
argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null
or return 0
# These flags function as commands, effectively.
set -q _flag_version; and return 1
set -q _flag_html_path; and return 1
set -q _flag_man_path; and return 1
set -q _flag_info_path; and return 1
if set -q argv[1]
# Also print the command, so this can be used to figure out what it is.
echo $argv[1]
return 1
end
return 0
end
function __fish_git_config_keys
# Print already defined config values first
# Config keys may span multiple lines, so parse using null char
@@ -614,12 +633,19 @@ git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline
set -g __fish_git_alias_$alias $command $cmdline
end
function __fish_git_needs_command
$__fish_git_needs_command
end
function __fish_git_using_command
contains $__fish_git_subcommand $argv
set -l cmd (__fish_git_needs_command)
test -z "$cmd"
and return 1
contains -- $cmd $argv
and return 0
# Check aliases.
set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
set -q $varname
and contains -- $$varname[1][1] $argv
and return 0
return 1
end
function __fish_git_contains_opt
@@ -630,8 +656,10 @@ function __fish_git_contains_opt
# Now check the alias
argparse s= -- $argv
if set -q __fish_git_expanded_alias[1]
echo -- $__fish_git_expanded_alias | read -lat toks
set -l cmd (__fish_git_needs_command)
set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
if set -q $varname
echo -- $$varname | read -lat toks
set toks (string replace -r '(-.*)=.*' '' -- $toks)
for i in $argv
if contains -- --$i $toks
@@ -1408,7 +1436,7 @@ complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare
### log
complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog'
complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs'
complete -c git -n '__fish_git_using_command log' -a '(git ls-files)'
complete -c git -n '__fish_git_using_command log' -a '(__fish_git ls-files)'
complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames'
complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t print ref names'
@@ -1681,7 +1709,7 @@ complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files i
### mv
complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file, a directory, or a symlink'
complete -f -c git -n '__fish_git_using_command mv' -a '(git ls-files)'
complete -f -c git -n '__fish_git_using_command mv' -a '(__fish_git ls-files)'
complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rename/moving even if target exists'
complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move which can lead to error'
complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only show what would happen'
@@ -2267,29 +2295,3 @@ for file in $PATH/git-*
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
set -a __fish_git_custom_commands_completion $subcommand
end
complete -c git -f -a '(
set -g __fish_git_needs_command true
set -g __fish_git_subcommand ""
set -g __fish_git_expanded_alias
set -l cmd (commandline -opc)
set -e cmd[1]
argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null
or return
if set -q argv[1] || set -q _flag_version || set -q _flag_html_path || set -q _flag_man_path || set -q _flag_info_path
set __fish_git_needs_command false
end
if set -q argv[1]
set -l subcommand $argv[1]
# TODO Expand recursive aliases.
set -l varname __fish_git_alias_(string escape --style=var -- $subcommand)
if set -q $varname
set -g __fish_git_expanded_alias $$varname
set subcommand $__fish_git_expanded_alias[1]
end
set -g __fish_git_subcommand "$subcommand"
end
)'

View File

@@ -0,0 +1,29 @@
complete navi --no-files
set --local sub_commands fn help info repo widget
set --local options best-match cheatsh finder fzf-overrides fzf-overrides-var help path print query tag-rules tldr version
# subcommands
complete navi -n "not __fish_seen_subcommand_from $sub_commands && \
not __fish_contains_opt -s h -s p -s q -s V $options" -a "$sub_commands"
set --local internal_functions "url::open welcome widget::last_command map::expand"
complete navi -n "__fish_seen_subcommand_from fn && not __fish_seen_subcommand_from $internal_functions" \
-k -a $internal_functions
set --local supported_shells "bash zsh fish elvish"
complete navi -n "__fish_seen_subcommand_from widget && not __fish_seen_subcommand_from $supported_shells" -k -a $supported_shells
# options
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l best-match -d "Returns the best match"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l cheatsh -d "Searches for cheatsheets using the cheat.sh repository"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l finder -a "fzf skim" -d "Finder application to use"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides -d "Finder overrides for snippet selection"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides-var -d "Finder overrides for variable selection"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s h -l help -d "Print help information"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -r -s p -l path -d "Colon-separated list of paths containing .cheat files"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l print -d "Instead of executing a snippet, prints it to stdout"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s q -l query -d "Prepopulates the search field"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tag-rules -d "[Experimental] Comma-separated list that acts as filter for tags. Parts starting with ! represent negation"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tldr -d "Searches for cheatsheets using the tldr-pages repository"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s V -l version -d "Print version information"

View File

@@ -0,0 +1,25 @@
function __fish_qdbus_complete
argparse system 'bus=' literal help -- (commandline --cut-at-cursor --tokenize) 2>/dev/null
or return
if set -q _flag_help
return
end
set -l qdbus_flags $_flag_system
if set -q _flag_bus
set -a qdbus_flags --bus $_flag_bus
end
set argc (count $argv)
if test $argc -le 3
# avoid completion of property value
qdbus $qdbus_flags $argv[2] $argv[3] | string replace --regex '^(property(\ read)?|signal|method) ((\{.+\})|([^\ ]+)) ([^\(]+)(\(.+?\))?' '$6\t$1 $3 $7' | string trim
end
end
complete -c qdbus -f
complete -c qdbus -l system -d 'connect to the system bus'
complete -c qdbus -l bus -r -d 'connect to a custom bus'
complete -c qdbus -l literal -d 'print replies literally'
complete -c qdbus -l help -d 'print usage'
complete -c qdbus -a '(__fish_qdbus_complete)'

View File

@@ -0,0 +1,30 @@
complete -c reflector -f
# options
complete -c reflector -s h -l help -d 'Show help'
complete -c reflector -l connection-timeout -d 'The number of seconds to wait before a connection times out'
complete -c reflector -l download-timeout -d 'The number of seconds to wait before a download times out'
complete -c reflector -l list-countries -d 'Display a table of the distribution of servers by country'
complete -c reflector -l cache-timeout -d 'The cache timeout in seconds for the data retrieved from the Arch Linux Mirror Status API'
complete -c reflector -l url -d 'The URL from which to retrieve the mirror data in JSON format'
complete -c reflector -l save -d 'Save the mirrorlist to the given path'
complete -c reflector -l sort -d 'Sort the mirrorlist' -xa 'age rate country score delay'
complete -c reflector -l threads -d 'The number of threads to use for downloading'
complete -c reflector -l verbose -d 'Print extra information'
complete -c reflector -l info -d 'Print mirror information instead of a mirror list'
# filters
complete -c reflector -s a -l age -d 'Only return mirrors that have synchronized in the last n hours'
complete -c reflector -l delay -d 'Only return mirrors with a reported sync delay of n hours or less, where n is a float'
complete -c reflector -s c -l country -d 'Restrict mirrors to selected countries' -xa "(reflector --list-countries | cut -f 1 -d ' ' | tail -n +3)"
complete -c reflector -s f -l fastest -d 'Return the n fastest mirrors that meet the other criteria'
complete -c reflector -s i -l include -d 'Include servers that match <regex>'
complete -c reflector -s x -l exclude -d 'Exclude servers that match <regex>'
complete -c reflector -s l -l latest -d 'Limit the list to the n most recently synchronized servers'
complete -c reflector -l score -d 'Limit the list to the n servers with the highest score'
complete -c reflector -s n -l number -d 'Return at most n mirrors'
complete -c reflector -s p -l protocol -d 'Match one of the given protocols' -xa 'http https ftp rsync'
complete -c reflector -l completion-percent -d 'Set the minimum completion percent for the returned mirrors'
complete -c reflector -l isos -d 'Only return mirrors that host ISOs'
complete -c reflector -l ipv4 -d 'Only return mirrors that support IPv4'
complete -c reflector -l ipv6 -d 'Only return mirrors that support IPv6'

View File

@@ -59,9 +59,12 @@ complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" -
"
complete -c scp -s 3 -d "Copies between two remote hosts are transferred through the local host"
complete -c scp -s B -d "Batch mode"
complete -c scp -s D -x -d "Connect directly to a local SFTP server"
complete -c scp -s l -x -d "Bandwidth limit"
complete -c scp -s O -d "Use original SCP protocol instead of SFTP"
complete -c scp -s P -x -d Port
complete -c scp -s p -d "Preserves modification times, access times, and modes from the original file"
complete -c scp -s R -d "Copies between two remote hosts are performed by executing scp on the origin host"
complete -c scp -s r -d "Recursively copy"
complete -c scp -s S -d "Encryption program"
complete -c scp -s T -d "Disable strict filename checking"

View File

@@ -188,7 +188,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
# Ctrl-space inserts space without expanding abbrs
bind --preset $argv -k nul 'test -n "$(commandline)" && commandline -i " "'
# Shift-space (CSI u escape sequence) behaves like space because it's easy to mistype.
bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr'.
bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr'
bind --preset $argv \n execute

View File

@@ -35,6 +35,11 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
set cmd_line (string trim (string sub -l $truncated_len $cmd_line))$ellipsis
end
if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
# Add a newline *before* our message so we get the message after the commandline.
echo >&2
end
switch $signal_or_end_name
case STOPPED
printf ( _ "fish: Job %s, '%s' has stopped\n" ) $job_id $cmd_line
@@ -49,9 +54,11 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
$job_id $cmd_line $signal_or_end_name $signal_desc
end
end >&2
string repeat \n --count=(math (count (fish_prompt)) - 1) >&2
if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
# We want one newline per line in the prompt after the first.
# To ensure that, don't let `string repeat` add a newline. See #9044.
string repeat -N \n --count=(math (count (fish_prompt)) - 1) >&2
commandline -f repaint
end
end

View File

@@ -37,9 +37,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
# - It is set for xterm, and everyone and their dog claims to be xterm
#
# So we just don't care about $TERM, unless it is one of the few terminals that actually have their own entry.
#
# Note: Previous versions also checked $TMUX, and made sure that then $TERM was screen* or tmux*.
# We don't care, since we *cannot* handle term-in-a-terms 100% correctly.
if not set -q KONSOLE_PROFILE_NAME
and not test -n "$KONSOLE_VERSION" -a "$KONSOLE_VERSION" -ge 200400 # konsole, but new.
and not set -q ITERM_PROFILE
@@ -52,6 +49,10 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
and not string match -q 'rxvt*' -- $TERM
and not string match -q 'alacritty*' -- $TERM
and not string match -q 'foot*' -- $TERM
and not begin
set -q TMUX
and string match -qr '^screen|^tmux' -- $TERM
end
return
end
end
@@ -78,13 +79,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
set function __fish_cursor_xterm
end
set -l tmux_prefix
set -l tmux_postfix
if set -q TMUX
set tmux_prefix echo -ne "'\ePtmux;\e'"
set tmux_postfix echo -ne "'\e\\\\'"
end
set -q fish_cursor_unknown
or set -g fish_cursor_unknown block
@@ -94,9 +88,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
if not set -q \$varname
set varname fish_cursor_unknown
end
$tmux_prefix
$function \$\$varname
$tmux_postfix
end
" | source
@@ -106,9 +98,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
if not set -q \$varname
set varname fish_cursor_unknown
end
$tmux_prefix
$function \$\$varname
$tmux_postfix
end
" | source
end

View File

@@ -305,6 +305,12 @@ maybe_t<int> builtin_history(parser_t &parser, io_streams_t &streams, const wcha
break;
}
if (in_private_mode(parser.vars())) {
streams.err.append_format(
_(L"%ls: can't merge history in private mode\n"), cmd);
status = STATUS_INVALID_ARGS;
break;
}
history->incorporate_external_changes();
break;
}

View File

@@ -263,6 +263,12 @@ void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end
} else {
// This isn't entirely fatal - the value should still be printed.
this->nonfatal_error(_(L"%ls: value not completely converted (can't convert '%ls')"), s, end);
// Warn about octal numbers as they can be confusing.
// Do it if the unconverted digit is a valid hex digit,
// because it could also be an "0x" -> "0" typo.
if (*s == L'0' && iswxdigit(*end)) {
this->nonfatal_error(_(L"Hint: a leading '0' without an 'x' indicates an octal number"), s, end);
}
}
}
}

View File

@@ -1900,7 +1900,17 @@ std::string get_executable_path(const char *argv0) {
}
if (len > 0) {
buff[len] = '\0';
return std::string(buff);
// When /proc/self/exe points to a file that was deleted (or overwritten on update!)
// then linux adds a " (deleted)" suffix.
// If that's not a valid path, let's remove that awkward suffix.
std::string buffstr{buff};
if (access(buff, F_OK)) {
auto dellen = const_strlen(" (deleted)");
if (buffstr.size() > dellen && buffstr.compare(buffstr.size() - dellen, dellen, " (deleted)") == 0) {
buffstr = buffstr.substr(0, buffstr.size() - const_strlen(" (deleted)"));
}
}
return buffstr;
}
#endif

View File

@@ -548,6 +548,9 @@ int main(int argc, char **argv) {
res = run_command_list(parser, &opts.postconfig_cmds, {});
}
// Clear signals in case we were interrupted (#9024).
signal_clear_cancel();
if (!opts.batch_cmds.empty()) {
// Run the commands specified as arguments, if any.
if (get_login()) {

View File

@@ -755,12 +755,12 @@ char_event_t inputter_t::read_char(const command_handler_t &command_handler) {
}
case readline_cmd_t::func_and:
case readline_cmd_t::func_or: {
// If previous function has right status, we keep reading tokens
// If previous function has correct status, we keep reading tokens
if (evt.get_readline() == readline_cmd_t::func_and) {
if (function_status_) return readch();
// Don't return immediately, we might need to handle it here - like self-insert.
if (function_status_) continue;
} else {
assert(evt.get_readline() == readline_cmd_t::func_or);
if (!function_status_) return readch();
if (!function_status_) continue;
}
// Else we flush remaining tokens
do {

View File

@@ -543,6 +543,14 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
actual_cmd);
break;
}
#ifdef EBADARCH
case EBADARCH: {
FLOGF_SAFE(exec,
"Failed to execute process '%s': Bad CPU type in executable.",
actual_cmd);
break;
}
#endif
default: {
char errnum_buff[64];
format_long_safe(errnum_buff, err);

View File

@@ -3,6 +3,8 @@
# e.g. the fish_git_prompt variable handlers test `status is-interactive`.
#REQUIRES: command -v git
set -g fish (status fish-path)
# Tests run from git (e.g. git rebase --exec 'ninja test'...) inherit a weird git environment.
# Ensure that no git environment variables are inherited.
for varname in (set -x | string match 'GIT_*' | string replace -r ' .*' '')
@@ -134,3 +136,6 @@ test "$(complete -C'git re ')" = "$(complete -C'git restore --staged ')"
or begin
echo -- Oops re completes unlike restore --staged
end
$fish -c 'complete -C "git -C ./.gi"'
# CHECK: ./.git/ Directory

View File

@@ -66,3 +66,7 @@ builtin history -t merge
# Now do a history command that should succeed so we exit with a zero,
# success, status.
builtin history save
set -g fish_private_mode 1
builtin history merge
#CHECKERR: history: can't merge history in private mode

View File

@@ -95,3 +95,27 @@ printf '%d\n' 15.1
# CHECKERR: 15.1: value not completely converted (can't convert '.1')
echo $status
# CHECK: 1
printf '%d\n' 07
# CHECK: 7
echo $status
# CHECK: 0
printf '%d\n' 08
# CHECK: 0
# CHECKERR: 08: value not completely converted (can't convert '8')
# CHECKERR: Hint: a leading '0' without an 'x' indicates an octal number
echo $status
# CHECK: 1
printf '%d\n' 0f
# CHECK: 0
# CHECKERR: 0f: value not completely converted (can't convert 'f')
# CHECKERR: Hint: a leading '0' without an 'x' indicates an octal number
echo $status
# CHECK: 1
printf '%d\n' 0g
# CHECK: 0
# CHECKERR: 0g: value not completely converted (can't convert 'g')
echo $status
# CHECK: 1

View File

@@ -292,6 +292,16 @@ send("echo git@github.com:fish-shell/fish-shell")
send("\x17\x17\x17\r")
expect_prompt("git@", unmatched="ctrl-w does not stop at @")
sendline("abbr --add foo 'echo foonanana'")
expect_prompt()
sendline("bind ' ' expand-abbr or self-insert")
expect_prompt()
send("foo ")
expect_str("echo foonanana")
send(" banana\r")
expect_str(" banana\r")
expect_prompt("foonanana banana")
# Ensure that nul can be bound properly (#3189).
send("bind -k nul 'echo nul seen'\r")
expect_prompt()