mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
More efficient encoding for cmdline in the prompt marking escape code
This commit is contained in:
parent
1e528fd299
commit
219e53826b
5 changed files with 10 additions and 12 deletions
|
|
@ -204,9 +204,7 @@ _ksi_main() {
|
|||
builtin printf "\e]2;%s%s\a" "${_ksi_prompt[hostname_prefix]@P}" "${_ksi_prompt[last_cmd]//[[:cntrl:]]}" # remove any control characters
|
||||
fi
|
||||
if [[ "${_ksi_prompt[mark]}" == "y" ]]; then
|
||||
builtin printf "\e]133;C;cmdline="
|
||||
for (( i=0; i<${#last_cmd}; i++ )); do builtin printf '%x ' "'${last_cmd:$i:1}"; done
|
||||
builtin printf "\a"
|
||||
builtin printf "\e]133;C;cmdline=%q\a" "$last_cmd"
|
||||
fi
|
||||
}
|
||||
if [[ "${_ksi_prompt[title]}" == "y" || "${_ksi_prompt[mark]}" ]]; then _ksi_prompt[ps0]+='$(_ksi_get_current_command)'; fi
|
||||
|
|
|
|||
|
|
@ -215,9 +215,7 @@ _ksi_deferred_init() {
|
|||
# its preexec hook before us, we'll incorrectly mark its output as
|
||||
# belonging to the command (as if the user typed it into zle) rather
|
||||
# than command output.
|
||||
builtin print -nu "$_ksi_fd" '\e]133;C;cmdline='
|
||||
for (( i=0; i<${#1}; i++ )); do builtin print -nu "$_ksi_fd" -f '%x ' "'${1:$i:1}"; done
|
||||
builtin print -nu "$_ksi_fd" '\a'
|
||||
builtin print -nu "$_ksi_fd" -f '\e]133;C;cmdline=%q\a' "$1"
|
||||
(( _ksi_state = 1 ))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue