summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-05-27 06:50:05 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-05-27 06:50:05 +0000
commitc1870eec74ccf5999ce654cbd4b160c1a552c311 (patch)
treec831beb737edd210eaf6f4d87888326b3dfcfa21 /usr.bin
parent485707c84d2f2e0f77e2c6e721596b77e85bc879 (diff)
Fix the intended ordering of items in buffer mode - it should not always
be tag 0 when the tree is empty. GitHub issue 1759.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/mode-tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index 4b60e626f85..e726164582d 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.31 2019/05/26 17:34:45 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.32 2019/05/27 06:50:04 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -384,7 +384,7 @@ mode_tree_build(struct mode_tree_data *mtd)
if (mtd->line_list != NULL)
tag = mtd->line_list[mtd->current].item->tag;
else
- tag = 0;
+ tag = UINT64_MAX;
TAILQ_CONCAT(&mtd->saved, &mtd->children, entry);
TAILQ_INIT(&mtd->children);
@@ -400,6 +400,8 @@ mode_tree_build(struct mode_tree_data *mtd)
mode_tree_clear_lines(mtd);
mode_tree_build_lines(mtd, &mtd->children, 0);
+ if (tag == UINT64_MAX)
+ tag = mtd->line_list[mtd->current].item->tag;
mode_tree_set_current(mtd, tag);
mtd->width = screen_size_x(s);