diff --git a/scripts/restore.sh b/scripts/restore.sh index af7a431..f1bd622 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -310,7 +310,7 @@ restore_shell_history() { if [ "$pane_command" = "bash" ]; then local read_command="history -r '$history_file'" - tmux send-keys -t "$pane_id" "$read_command" C-m + tmux send-keys -t "$pane_id" M-z "$read_command" C-m M-Z elif [ "$pane_command" = "zsh" ]; then local accept_line="$(expr "$(zsh -i -c bindkey | grep -m1 '\saccept-line$')" : '^"\(.*\)".*')" local read_command="fc -R '$history_file'; clear" diff --git a/scripts/save.sh b/scripts/save.sh index ff424b9..0ec6e0d 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -176,9 +176,8 @@ save_shell_history() { local read_command=" $history_r '$(resurrect_history_file "$pane_id" "$pane_command")'" # C-e C-u is a Bash shortcut sequence to clear whole line. It is necessary to # delete any pending input so it does not interfere with our history command. - tmux send-keys -t "$pane_id" "$end_of_line" "$backward_kill_line" "$write_command" "$accept_line" - # Immediately restore after saving - tmux send-keys -t "$pane_id" "$end_of_line" "$backward_kill_line" "$read_command" "$accept_line" + # and immediately restore after saving + tmux send-keys -t "$pane_id" "$end_of_line" "$backward_kill_line" M-z "$write_command;$read_command" "$accept_line" M-Z fi }