mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-21 20:08:48 +00:00
Add an option to save the full pane contents
By default only the visible pane area is captured and restored. The @resurrect-pane-contents-area option lets the full pane area be captured instead.
This commit is contained in:
parent
b22b2a7203
commit
4f685d5c3d
@ -78,7 +78,8 @@ state_format() {
|
||||
}
|
||||
|
||||
dump_panes_raw() {
|
||||
tmux list-panes -a -F "$(pane_format)"
|
||||
local format="${1:-$(pane_format)}"
|
||||
tmux list-panes -a -F "$format"
|
||||
}
|
||||
|
||||
dump_windows_raw(){
|
||||
@ -110,7 +111,9 @@ pane_full_command() {
|
||||
|
||||
capture_pane_contents() {
|
||||
local pane_id="$1"
|
||||
tmux capture-pane -ep -t "$pane_id" > "$(resurrect_pane_file "$pane_id")"
|
||||
local start_line="0"
|
||||
[[ "$(get_tmux_option "$pane_contents_area_option" "visible")" == "full" ]] && start_line="-$2"
|
||||
tmux capture-pane -ep -S "$start_line" -t "$pane_id" > "$(resurrect_pane_file "$pane_id")"
|
||||
}
|
||||
|
||||
save_shell_history() {
|
||||
@ -207,9 +210,9 @@ dump_state() {
|
||||
}
|
||||
|
||||
dump_pane_contents() {
|
||||
dump_panes |
|
||||
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; do
|
||||
capture_pane_contents "$session_name:$window_number.$pane_index"
|
||||
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"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,13 @@ inline_strategy_token="->"
|
||||
save_command_strategy_option="@resurrect-save-command-strategy"
|
||||
default_save_command_strategy="ps"
|
||||
|
||||
# Pane contents capture options.
|
||||
# @resurrect-pane-contents-area option can be:
|
||||
# 'visible' - capture only the visible pane area (default)
|
||||
# 'full' - capture the full pane contents
|
||||
pane_contents_option="@resurrect-capture-pane-contents"
|
||||
pane_contents_area_option="@resurrect-pane-contents-area"
|
||||
|
||||
bash_history_option="@resurrect-save-bash-history"
|
||||
|
||||
# set to 'on' to ensure panes are never ever overwritten
|
||||
|
Loading…
Reference in New Issue
Block a user