This commit is contained in:
Kovid Goyal 2022-07-26 11:04:01 +05:30
commit a352804c14
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
5 changed files with 25 additions and 22 deletions

View file

@ -76,12 +76,14 @@ Detailed list of changes
- Bash integration: Fix declare not creating global variables in .bashrc (:iss:`5254`)
- :command`kitty @ scroll-window` allow scrolling by fractions of a screen
- :command:`kitty @ scroll-window` allow scrolling by fractions of a screen
(:iss:`5294`)
- remote files kitten: Fix working with files whose names have characters that
need to be quoted in shell scripts (:iss:`5313`)
- Expand ~ in paths configured in :opt:`editor` and :opt:`exe_search_path` (:disc:`5298`)
0.25.2 [2022-06-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -670,6 +670,7 @@ def get_editor(opts: Optional[Options] = None, path_to_edit: str = '', line_numb
else:
import shlex
ans = shlex.split(opts.editor)
ans[0] = os.path.expanduser(ans[0])
if path_to_edit:
if line_number:
eq = os.path.basename(ans[0]).lower()
@ -778,11 +779,11 @@ def which(name: str, only_system: bool = False) -> Optional[str]:
x = x.strip()
if x:
if x[0] == '-':
tried_paths.add(x[1:])
tried_paths.add(os.path.expanduser(x[1:]))
elif x[0] == '+':
append_paths.append(x[1:])
append_paths.append(os.path.expanduser(x[1:]))
else:
paths.append(x)
paths.append(os.path.expanduser(x))
ep = os.environ.get('PATH')
if ep:
paths.extend(ep.split(os.pathsep))

View file

@ -162,7 +162,7 @@ _ksi_main() {
# in particular this means cwd reporting will not happen for a
# command like cd /test && cat. PS0 is evaluated before cd is run.
if [[ "${_ksi_prompt[last_reported_cwd]}" != "$PWD" ]]; then
_ksi_prompt[last_reported_cwd]="$PWD";
_ksi_prompt[last_reported_cwd]="$PWD"
builtin printf "\e]7;kitty-shell-cwd://%s%s\a" "$HOSTNAME" "$PWD"
fi
fi
@ -392,27 +392,27 @@ edit-in-kitty() {
builtin trap -- "builtin command stty '$old_tty_settings'; _ksi_transmit_data 'abort_signaled=interrupt' 'edit'; builtin exit 1;" SIGINT SIGTERM
while :; do
started="n"
while IFS= read -r line; do
while IFS= builtin read -r line; do
if [ "$started" = "y" ]; then
[ "$line" = "UPDATE" ] && break;
[ "$line" = "UPDATE" ] && break
[ "$line" = "DONE" ] && { started="done"; break; }
builtin printf "%s\n" "$line" > /dev/stderr;
return 1;
builtin printf "%s\n" "$line" > /dev/stderr
return 1
else
[ "$line" = "KITTY_DATA_START" ] && started="y"
fi
done
[ "$started" = "n" ] && continue;
[ "$started" = "n" ] && continue
data=""
while IFS= read -r line; do
[ "$line" = "KITTY_DATA_END" ] && break;
while IFS= builtin read -r line; do
[ "$line" = "KITTY_DATA_END" ] && break
data="$data$line"
done
[ -n "$data" -a "$started" != "done" ] && {
builtin echo "Updating $ed_filename..."
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
}
[ "$started" = "done" ] && break;
[ "$started" = "done" ] && break
done
}
$(_ksi_wait_for_complete > /dev/tty)

View file

@ -186,7 +186,7 @@ function clone-in-kitty -d "Clone the current fish session into a new kitty wind
set --local b64_envs (string join0 -- $envs | base64)
set --local b64_cwd (printf "%s" "$PWD" | base64)
set --prepend data "shell=fish" "pid=$fish_pid" "cwd=$b64_cwd" "env=$b64_envs"
__ksi_transmit_data (string join "," -- $data | tr -d "\t\n\r ") "clone"
__ksi_transmit_data (string join "," -- $data | string replace --regex --all "\s" "") "clone"
end
function edit-in-kitty -d "Edit the specified file in a new kitty overlay using your preferred editor, even over SSH"
@ -234,7 +234,7 @@ function edit-in-kitty -d "Edit the specified file in a new kitty overlay using
end
set --local file_data (base64 < "$ed_filename")
set --append data "file_data=$file_data"
__ksi_transmit_data (string join "," -- $data | tr -d "\t\n\r ") "edit"
__ksi_transmit_data (string join "," -- $data | string replace --regex --all "\s" "") "edit"
set --erase data
echo "Waiting for editing to be completed..."
set --global __ksi_waiting_for_edit "y"

View file

@ -474,26 +474,26 @@ edit-in-kitty() {
builtin trap "builtin command stty '$old_tty_settings'; _ksi_transmit_data 'abort_signaled=interrupt' 'edit'; return 1;" INT TERM
while :; do
started="n"
while IFS= read -r line; do
while IFS= builtin read -r line; do
if [ "$started" = "y" ]; then
[ "$line" = "UPDATE" ] && break;
[ "$line" = "DONE" ] && { started="done"; break; }
builtin printf "%s\n" "$line" > /dev/stderr;
return 1;
builtin printf "%s\n" "$line" > /dev/stderr
return 1
else
[ "$line" = "KITTY_DATA_START" ] && started="y"
fi
done
[ "$started" = "n" ] && continue;
[ "$started" = "n" ] && continue
data=""
while IFS= read -r line; do
[ "$line" = "KITTY_DATA_END" ] && break;
while IFS= builtin read -r line; do
[ "$line" = "KITTY_DATA_END" ] && break
data="$data$line"
done
[ -n "$data" -a "$started" != "done" ] && {
builtin echo "Updating $ed_filename..."
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
}
[ "$started" = "done" ] && break;
[ "$started" = "done" ] && break
done
}