From ba7a0894c37fd7e94953f867d60f7b58c8db052c Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 4 Jul 2022 08:24:36 +0000 Subject: [PATCH] Mouse clicks could change current item, so work it out again. GitHub issue 3242. --- usr.bin/tmux/window-tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index c2c9b56c1da..fd3a9ab7a39 100644 --- a/usr.bin/tmux/window-tree.c +++ b/usr.bin/tmux/window-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-tree.c,v 1.60 2022/05/30 12:55:25 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.61 2022/07/04 08:24:36 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -1243,12 +1243,17 @@ window_tree_key(struct window_mode_entry *wme, struct client *c, item = mode_tree_get_current(data->data); finished = mode_tree_key(data->data, c, &key, m, &x, &y); + +again: if (item != (new_item = mode_tree_get_current(data->data))) { item = new_item; data->offset = 0; } - if (KEYC_IS_MOUSE(key) && m != NULL) + if (KEYC_IS_MOUSE(key) && m != NULL) { key = window_tree_mouse(data, key, x, item); + goto again; + } + switch (key) { case '<': data->offset--; -- 2.20.1