mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-10 14:01:26 +00:00
Improved handling of fields that can be empty
This commit is contained in:
parent
c78a38803a
commit
aa8f323b8b
@ -39,6 +39,10 @@ tmux_socket() {
|
|||||||
echo $TMUX | cut -d',' -f1
|
echo $TMUX | cut -d',' -f1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_first_char() {
|
||||||
|
echo "$1" | cut -c2-
|
||||||
|
}
|
||||||
|
|
||||||
new_window() {
|
new_window() {
|
||||||
local session_name="$1"
|
local session_name="$1"
|
||||||
local window_number="$2"
|
local window_number="$2"
|
||||||
@ -71,7 +75,8 @@ new_pane() {
|
|||||||
restore_pane() {
|
restore_pane() {
|
||||||
local pane="$1"
|
local pane="$1"
|
||||||
echo "$pane" |
|
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
|
if window_exists "$session_name" "$window_number"; then
|
||||||
new_pane "$session_name" "$window_number" "$window_name" "$dir"
|
new_pane "$session_name" "$window_number" "$window_name" "$dir"
|
||||||
elif session_exists "$session_name"; then
|
elif session_exists "$session_name"; then
|
||||||
|
@ -13,9 +13,9 @@ pane_format() {
|
|||||||
format+="${delimiter}"
|
format+="${delimiter}"
|
||||||
format+="#{window_index}"
|
format+="#{window_index}"
|
||||||
format+="${delimiter}"
|
format+="${delimiter}"
|
||||||
format+="#{pane_current_path}"
|
format+=":#{window_name}"
|
||||||
format+="${delimiter}"
|
format+="${delimiter}"
|
||||||
format+="#{window_name}"
|
format+="#{pane_current_path}"
|
||||||
echo "$format"
|
echo "$format"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user