mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Renumber windows: Lookup lastw via window not index
When calling 'movew -r' on a session to reorder the winlinks, ensure when adding back in the information for the lastw stack that we look up the winlink based on the window and not its index. Using the index doesn't make sense here because when comparing it to the old set, it will never match since the winlink has been renumbered. Bug reported by Ben Boeckel. Patch by Thomas Adam.
This commit is contained in:
parent
784b711393
commit
34674bb180
@ -616,7 +616,7 @@ session_renumber_windows(struct session *s)
|
|||||||
memcpy(&old_lastw, &s->lastw, sizeof old_lastw);
|
memcpy(&old_lastw, &s->lastw, sizeof old_lastw);
|
||||||
TAILQ_INIT(&s->lastw);
|
TAILQ_INIT(&s->lastw);
|
||||||
TAILQ_FOREACH(wl, &old_lastw, sentry) {
|
TAILQ_FOREACH(wl, &old_lastw, sentry) {
|
||||||
wl_new = winlink_find_by_index(&s->windows, wl->idx);
|
wl_new = winlink_find_by_window(&s->windows, wl->window);
|
||||||
if (wl_new != NULL)
|
if (wl_new != NULL)
|
||||||
TAILQ_INSERT_TAIL(&s->lastw, wl_new, sentry);
|
TAILQ_INSERT_TAIL(&s->lastw, wl_new, sentry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user