Fix regression causing error and prompt corruption on paste

Closes #7782

[ci skip]
This commit is contained in:
Mahmoud Al-Qudsi 2021-03-05 17:08:54 -06:00
parent 6bc0064a2a
commit e450190d50

View file

@ -8,7 +8,9 @@ function __fish_tokenizer_state --description "Print the state of the tokenizer
# - single-escaped - open \\ inside single-quotes
# - double-escaped - open \\ inside double-quotes
argparse --min-args 1 --max-args 1 i/initial-state= -- $argv
# Don't expect one arg only, as (commandline -ct) may evaluate to multiple arguments since
# output is forcibly split on new lines (issue #7782).
argparse --min-args 1 i/initial-state= -- $argv
or return 1
set -l state normal
@ -16,7 +18,11 @@ function __fish_tokenizer_state --description "Print the state of the tokenizer
set str $_flag_initial_state
end
for char in (string split -- "" $argv[1])
# HACK: We care about quotes and don't care about new lines, joining multi-line arguments
# produced by (commandline -ct) on anything other than \n will corrupt the contents but will
# allow the following logic to work (including escape of subsequent character). This entire
# function should probably be implemented as part of the `commandline` builtin.
for char in (string split -- "" (string join -- \x1e $argv))
switch $char
case "'" # single-quote
switch $state