mirror of
				https://github.com/tmux-plugins/tmux-resurrect.git
				synced 2025-11-04 00:46:04 +00:00 
			
		
		
		
	Improved handling of fields that can be empty
This commit is contained in:
		@@ -39,6 +39,10 @@ tmux_socket() {
 | 
			
		||||
	echo $TMUX | cut -d',' -f1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
remove_first_char() {
 | 
			
		||||
	echo "$1" | cut -c2-
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
new_window() {
 | 
			
		||||
	local session_name="$1"
 | 
			
		||||
	local window_number="$2"
 | 
			
		||||
@@ -71,7 +75,8 @@ new_pane() {
 | 
			
		||||
restore_pane() {
 | 
			
		||||
	local pane="$1"
 | 
			
		||||
	echo "$pane" |
 | 
			
		||||
	while IFS=$'\t' read line_type session_name window_number dir window_name; do
 | 
			
		||||
	while IFS=$'\t' read line_type session_name window_number window_name dir; do
 | 
			
		||||
		window_name="$(remove_first_char $window_name)"
 | 
			
		||||
		if window_exists "$session_name" "$window_number"; then
 | 
			
		||||
			new_pane "$session_name" "$window_number" "$window_name" "$dir"
 | 
			
		||||
		elif session_exists "$session_name"; then
 | 
			
		||||
 
 | 
			
		||||
@@ -13,9 +13,9 @@ pane_format() {
 | 
			
		||||
	format+="${delimiter}"
 | 
			
		||||
	format+="#{window_index}"
 | 
			
		||||
	format+="${delimiter}"
 | 
			
		||||
	format+="#{pane_current_path}"
 | 
			
		||||
	format+=":#{window_name}"
 | 
			
		||||
	format+="${delimiter}"
 | 
			
		||||
	format+="#{window_name}"
 | 
			
		||||
	format+="#{pane_current_path}"
 | 
			
		||||
	echo "$format"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user