aboutsummaryrefslogtreecommitdiff
path: root/window-tree.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-07-21 15:53:59 -0600
committerJosh Rahm <rahm@google.com>2022-07-21 15:53:59 -0600
commitb11548e3db4361cd8312ffbd27472823bdab4d62 (patch)
treea84b5cf79fb41bb60b6495c1a346bb360b224604 /window-tree.c
parent88ebf5544e995d85b2f1416a216ac7f44f719eed (diff)
parentab1d18d00febe161080b8e81331861481110809f (diff)
downloadrtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.tar.gz
rtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.tar.bz2
rtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.zip
Merge remote-tracking branch 'origin/master' into rahm
Diffstat (limited to 'window-tree.c')
-rw-r--r--window-tree.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/window-tree.c b/window-tree.c
index 4998e1aa..1be47017 100644
--- a/window-tree.c
+++ b/window-tree.c
@@ -272,9 +272,10 @@ window_tree_cmp_window(const void *a0, const void *b0)
static int
window_tree_cmp_pane(const void *a0, const void *b0)
{
- const struct window_pane *const *a = a0;
- const struct window_pane *const *b = b0;
- int result;
+ struct window_pane **a = (struct window_pane **)a0;
+ struct window_pane **b = (struct window_pane **)b0;
+ int result;
+ u_int ai, bi;
if (window_tree_sort->field == WINDOW_TREE_BY_TIME)
result = (*a)->active_point - (*b)->active_point;
@@ -283,7 +284,9 @@ window_tree_cmp_pane(const void *a0, const void *b0)
* Panes don't have names, so use number order for any other
* sort field.
*/
- result = (*a)->id - (*b)->id;
+ window_pane_index(*a, &ai);
+ window_pane_index(*b, &bi);
+ result = ai - bi;
}
if (window_tree_sort->reversed)
result = -result;
@@ -519,7 +522,8 @@ window_tree_draw_label(struct screen_write_ctx *ctx, u_int px, u_int py,
if (ox > 1 && ox + len < sx - 1 && sy >= 3) {
screen_write_cursormove(ctx, px + ox - 1, py + oy - 1, 0);
- screen_write_box(ctx, len + 2, 3);
+ screen_write_box(ctx, len + 2, 3, BOX_LINES_DEFAULT, NULL,
+ NULL);
}
screen_write_cursormove(ctx, px + ox, py + oy, 0);
screen_write_puts(ctx, gc, "%s", label);
@@ -894,7 +898,7 @@ window_tree_get_key(void *modedata, void *itemdata, u_int line)
key = key_string_lookup_string(expanded);
free(expanded);
format_free(ft);
- return key;
+ return (key);
}
static struct screen *
@@ -1242,12 +1246,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--;