Use builtin to call read in zsh integration and bash integration
This commit is contained in:
parent
fa670e1f5d
commit
4e1cd0590b
@ -162,7 +162,7 @@ _ksi_main() {
|
|||||||
# in particular this means cwd reporting will not happen for a
|
# in particular this means cwd reporting will not happen for a
|
||||||
# command like cd /test && cat. PS0 is evaluated before cd is run.
|
# command like cd /test && cat. PS0 is evaluated before cd is run.
|
||||||
if [[ "${_ksi_prompt[last_reported_cwd]}" != "$PWD" ]]; then
|
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"
|
builtin printf "\e]7;kitty-shell-cwd://%s%s\a" "$HOSTNAME" "$PWD"
|
||||||
fi
|
fi
|
||||||
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
|
builtin trap -- "builtin command stty '$old_tty_settings'; _ksi_transmit_data 'abort_signaled=interrupt' 'edit'; builtin exit 1;" SIGINT SIGTERM
|
||||||
while :; do
|
while :; do
|
||||||
started="n"
|
started="n"
|
||||||
while IFS= read -r line; do
|
while IFS= builtin read -r line; do
|
||||||
if [ "$started" = "y" ]; then
|
if [ "$started" = "y" ]; then
|
||||||
[ "$line" = "UPDATE" ] && break;
|
[ "$line" = "UPDATE" ] && break
|
||||||
[ "$line" = "DONE" ] && { started="done"; break; }
|
[ "$line" = "DONE" ] && { started="done"; break; }
|
||||||
builtin printf "%s\n" "$line" > /dev/stderr;
|
builtin printf "%s\n" "$line" > /dev/stderr
|
||||||
return 1;
|
return 1
|
||||||
else
|
else
|
||||||
[ "$line" = "KITTY_DATA_START" ] && started="y"
|
[ "$line" = "KITTY_DATA_START" ] && started="y"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$started" = "n" ] && continue;
|
[ "$started" = "n" ] && continue
|
||||||
data=""
|
data=""
|
||||||
while IFS= read -r line; do
|
while IFS= builtin read -r line; do
|
||||||
[ "$line" = "KITTY_DATA_END" ] && break;
|
[ "$line" = "KITTY_DATA_END" ] && break
|
||||||
data="$data$line"
|
data="$data$line"
|
||||||
done
|
done
|
||||||
[ -n "$data" -a "$started" != "done" ] && {
|
[ -n "$data" -a "$started" != "done" ] && {
|
||||||
builtin echo "Updating $ed_filename..."
|
builtin echo "Updating $ed_filename..."
|
||||||
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
|
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
|
||||||
}
|
}
|
||||||
[ "$started" = "done" ] && break;
|
[ "$started" = "done" ] && break
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
$(_ksi_wait_for_complete > /dev/tty)
|
$(_ksi_wait_for_complete > /dev/tty)
|
||||||
|
|||||||
@ -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
|
builtin trap "builtin command stty '$old_tty_settings'; _ksi_transmit_data 'abort_signaled=interrupt' 'edit'; return 1;" INT TERM
|
||||||
while :; do
|
while :; do
|
||||||
started="n"
|
started="n"
|
||||||
while IFS= read -r line; do
|
while IFS= builtin read -r line; do
|
||||||
if [ "$started" = "y" ]; then
|
if [ "$started" = "y" ]; then
|
||||||
[ "$line" = "UPDATE" ] && break;
|
[ "$line" = "UPDATE" ] && break;
|
||||||
[ "$line" = "DONE" ] && { started="done"; break; }
|
[ "$line" = "DONE" ] && { started="done"; break; }
|
||||||
builtin printf "%s\n" "$line" > /dev/stderr;
|
builtin printf "%s\n" "$line" > /dev/stderr
|
||||||
return 1;
|
return 1
|
||||||
else
|
else
|
||||||
[ "$line" = "KITTY_DATA_START" ] && started="y"
|
[ "$line" = "KITTY_DATA_START" ] && started="y"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$started" = "n" ] && continue;
|
[ "$started" = "n" ] && continue
|
||||||
data=""
|
data=""
|
||||||
while IFS= read -r line; do
|
while IFS= builtin read -r line; do
|
||||||
[ "$line" = "KITTY_DATA_END" ] && break;
|
[ "$line" = "KITTY_DATA_END" ] && break
|
||||||
data="$data$line"
|
data="$data$line"
|
||||||
done
|
done
|
||||||
[ -n "$data" -a "$started" != "done" ] && {
|
[ -n "$data" -a "$started" != "done" ] && {
|
||||||
builtin echo "Updating $ed_filename..."
|
builtin echo "Updating $ed_filename..."
|
||||||
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
|
builtin printf "%s" "$data" | builtin command base64 -d > "$ed_filename"
|
||||||
}
|
}
|
||||||
[ "$started" = "done" ] && break;
|
[ "$started" = "done" ] && break
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user