Fix some of the errors in the last commit

First, make sure to include the ":" placeholder in the window_name
format.

Second, decrement the indices in relevant awk commands to make sure they
point to the right items.
This commit is contained in:
A Farzat 2021-08-27 13:27:00 +09:00
parent 6c9322aa99
commit 02a7f1f9d6
2 changed files with 5 additions and 5 deletions

View File

@ -300,7 +300,7 @@ restore_window_properties() {
} }
restore_shell_history() { restore_shell_history() {
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ { print $2, $3, $7, $10; }' $(last_resurrect_file) | awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ { print $2, $3, $6, $9; }' $(last_resurrect_file) |
while IFS=$d read session_name window_number pane_index pane_command; do while IFS=$d read session_name window_number pane_index pane_command; do
if ! is_pane_registered_as_existing "$session_name" "$window_number" "$pane_index"; then if ! is_pane_registered_as_existing "$session_name" "$window_number" "$pane_index"; then
local pane_id="$session_name:$window_number.$pane_index" local pane_id="$session_name:$window_number.$pane_index"
@ -321,7 +321,7 @@ restore_shell_history() {
restore_all_pane_processes() { restore_all_pane_processes() {
if restore_pane_processes_enabled; then if restore_pane_processes_enabled; then
local pane_full_command local pane_full_command
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $11 !~ "^:$" { print $2, $3, $7, $8, $11; }' $(last_resurrect_file) | awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $10 !~ "^:$" { print $2, $3, $6, $7, $10; }' $(last_resurrect_file) |
while IFS=$d read -r session_name window_number pane_index dir pane_full_command; do while IFS=$d read -r session_name window_number pane_index dir pane_full_command; do
dir="$(remove_first_char "$dir")" dir="$(remove_first_char "$dir")"
pane_full_command="$(remove_first_char "$pane_full_command")" pane_full_command="$(remove_first_char "$pane_full_command")"
@ -331,7 +331,7 @@ restore_all_pane_processes() {
} }
restore_active_pane_for_each_window() { restore_active_pane_for_each_window() {
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $9 == 1 { print $2, $3, $7; }' $(last_resurrect_file) | awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $8 == 1 { print $2, $3, $6; }' $(last_resurrect_file) |
while IFS=$d read session_name window_number active_pane; do while IFS=$d read session_name window_number active_pane; do
tmux switch-client -t "${session_name}:${window_number}" tmux switch-client -t "${session_name}:${window_number}"
tmux select-pane -t "$active_pane" tmux select-pane -t "$active_pane"
@ -339,7 +339,7 @@ restore_active_pane_for_each_window() {
} }
restore_zoomed_windows() { restore_zoomed_windows() {
awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $6 ~ /Z/ && $9 == 1 { print $2, $3; }' $(last_resurrect_file) | awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $5 ~ /Z/ && $8 == 1 { print $2, $3; }' $(last_resurrect_file) |
while IFS=$d read session_name window_number; do while IFS=$d read session_name window_number; do
tmux resize-pane -t "${session_name}:${window_number}" -Z tmux resize-pane -t "${session_name}:${window_number}" -Z
done done

View File

@ -59,7 +59,7 @@ window_format() {
format+="${delimiter}" format+="${delimiter}"
format+="#{window_index}" format+="#{window_index}"
format+="${delimiter}" format+="${delimiter}"
format+="#{window_name}" format+=":#{window_name}"
format+="${delimiter}" format+="${delimiter}"
format+="#{window_active}" format+="#{window_active}"
format+="${delimiter}" format+="${delimiter}"