Skip to content

Commit 6be2f34

Browse files
committed
automatic-rename: changelog and comments
1 parent 4234ba9 commit 6be2f34

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
### master
4+
- Proper handling of `automatic-rename` window option.
45

56
### v3.0.0, 2021-08-30
67
- save and restore tmux pane contents (@laomaiweng)

scripts/restore.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,13 @@ restore_window_properties() {
289289
local window_name
290290
\grep '^window' $(last_resurrect_file) |
291291
while IFS=$d read line_type session_name window_number window_name window_active window_flags window_layout automatic_rename; do
292+
tmux select-layout -t "${session_name}:${window_number}" "$window_layout"
293+
294+
# Below steps are properly handling window names and automatic-rename
295+
# option. `rename-window` is an extra command in some scenarios, but we
296+
# opted for always doing it to keep the code simple.
292297
window_name="$(remove_first_char "$window_name")"
293298
tmux rename-window -t "${session_name}:${window_number}" "$window_name"
294-
tmux select-layout -t "${session_name}:${window_number}" "$window_layout"
295299
if [ "${automatic_rename}" = ":" ]; then
296300
tmux set-option -u -t "${session_name}:${window_number}" automatic-rename
297301
else

scripts/save.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ dump_windows() {
246246
continue
247247
fi
248248
automatic_rename="$(tmux show-window-options -vt "${session_name}:${window_index}" automatic-rename)"
249-
# If the option was unset, place the ":" placeholder instead.
249+
# If the option was unset, use ":" as a placeholder.
250250
[ -z "${automatic_rename}" ] && automatic_rename=":"
251251
echo "${line_type}${d}${session_name}${d}${window_index}${d}${window_name}${d}${window_active}${d}${window_flags}${d}${window_layout}${d}${automatic_rename}"
252252
done

0 commit comments

Comments
 (0)