From fee40e21213229c7376470379be0404df45346bf Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Sat, 9 May 2015 12:22:48 +0200 Subject: [PATCH] Capture pane contents feature, small refactor --- scripts/save.sh | 8 ++++++-- scripts/variables.sh | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/save.sh b/scripts/save.sh index 5ca7e60..f103734 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -112,7 +112,10 @@ pane_full_command() { capture_pane_contents() { local pane_id="$1" local start_line="-$2" - [[ "$(get_tmux_option "$pane_contents_area_option" "full")" == "visible" ]] && start_line="0" + local pane_contents_area="$3" + if [ "$pane_contents_area" = "visible" ]; then + start_line="0" + fi tmux capture-pane -epJ -S "$start_line" -t "$pane_id" > "$(resurrect_pane_file "$pane_id")" } @@ -210,9 +213,10 @@ dump_state() { } dump_pane_contents() { + local pane_contents_area="$(get_tmux_option "$pane_contents_area_option" "$default_pane_contents_area")" paste -d"$d" <(dump_panes) <(dump_panes_raw "#{history_size}") | while IFS=$d read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command full_command history_size; do - capture_pane_contents "$session_name:$window_number.$pane_index" "$history_size" + capture_pane_contents "$session_name:$window_number.$pane_index" "$history_size" "$pane_contents_area" done } diff --git a/scripts/variables.sh b/scripts/variables.sh index f5fabb9..a5f708e 100644 --- a/scripts/variables.sh +++ b/scripts/variables.sh @@ -31,10 +31,11 @@ default_save_command_strategy="ps" # Pane contents capture options. # @resurrect-pane-contents-area option can be: -# 'visible' - capture only the visible pane area (default) +# 'visible' - capture only the visible pane area # 'full' - capture the full pane contents pane_contents_option="@resurrect-capture-pane-contents" pane_contents_area_option="@resurrect-pane-contents-area" +default_pane_contents_area="full" bash_history_option="@resurrect-save-bash-history"