Improved trailing newline handling in the fish shell integration
Thanks to some assistance from @faho See https://github.com/kovidgoyal/kitty/issues/4032#issuecomment-919936913
This commit is contained in:
parent
0a56ab7a1e
commit
f277cbf3f3
@ -60,8 +60,13 @@ function _ksi_main
|
|||||||
|
|
||||||
function _ksi_end_prompt
|
function _ksi_end_prompt
|
||||||
set --local cmd_status "$status"
|
set --local cmd_status "$status"
|
||||||
set --local op (_ksi_original_fish_prompt | string collect) # trim trailing newlines to mimic fish behavior
|
# fish trims one trailing newline from the output of fish_prompt, so
|
||||||
printf "%s" "$op"
|
# we need to do the same. See https://github.com/kovidgoyal/kitty/issues/4032
|
||||||
|
set --local op (_ksi_original_fish_prompt) # op is an array because fish splits on newlines in command substitution
|
||||||
|
if set -q op[2]
|
||||||
|
printf '%s\n' $op[1..-2] # print all but last element of array, each followed by a new line
|
||||||
|
end
|
||||||
|
printf '%s' $op[-1] # print the last component without a newline
|
||||||
set --global _ksi_prompt_state "prompt_end"
|
set --global _ksi_prompt_state "prompt_end"
|
||||||
_ksi_mark "B"
|
_ksi_mark "B"
|
||||||
return "$cmd_status" # preserve the value of $status
|
return "$cmd_status" # preserve the value of $status
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user