summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2019-05-27 06:50:04 +0000
committernicm <nicm>2019-05-27 06:50:04 +0000
commit65e5e1456179d68f36602a5976184b38cc4b636c (patch)
treebf599c5dfa4797f8378044dde0faa6ee1f29cf25
parent097973e3d50c831c020fb0b689c3a2d66ba83b7c (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.
-rw-r--r--mode-tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mode-tree.c b/mode-tree.c
index 8cb556c5..add17c82 100644
--- a/mode-tree.c
+++ b/mode-tree.c
@@ -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);