Refactoring: drop dependency on command

This commit is contained in:
Bruno Sutic 2015-05-09 15:05:30 +02:00
parent c85a3b4487
commit f3c6321501
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
2 changed files with 8 additions and 6 deletions

View File

@ -6,6 +6,7 @@
- set options quietly in `resurrect.tmux` script
- improve pane contents restoration: `cat <file>` is no longer shown in pane
content history
- refactoring: drop dependency on `paste` command
### v2.4.0, 2015-02-23
- add "tmux-test"

View File

@ -48,6 +48,8 @@ pane_format() {
format+="#{pane_current_command}"
format+="${delimiter}"
format+="#{pane_pid}"
format+="${delimiter}"
format+="#{history_size}"
echo "$format"
}
@ -78,8 +80,7 @@ state_format() {
}
dump_panes_raw() {
local format="${1:-$(pane_format)}"
tmux list-panes -a -F "$format"
tmux list-panes -a -F "$(pane_format)"
}
dump_windows_raw(){
@ -178,7 +179,7 @@ fetch_and_dump_grouped_sessions(){
dump_panes() {
local full_command
dump_panes_raw |
while IFS=$d read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command pane_pid; do
while IFS=$d read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command pane_pid history_size; do
# not saving panes from grouped sessions
if is_session_grouped "$session_name"; then
continue
@ -214,9 +215,9 @@ 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" "$pane_contents_area"
dump_panes_raw |
while IFS=$d read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command pane_pid history_size; do
capture_pane_contents "${session_name}:${window_number}.${pane_index}" "$history_size" "$pane_contents_area"
done
}