mirror of
https://github.com/tmux/tmux.git
synced 2025-04-14 07:18:49 +00:00
When using choose-tree -u, start with the current window
highlighted. From Thomas Adam.
This commit is contained in:
parent
04f54ab38f
commit
3d2b7d5bce
@ -228,9 +228,12 @@ windows_only:
|
|||||||
free(final_win_template_last);
|
free(final_win_template_last);
|
||||||
|
|
||||||
window_choose_ready(wl->window->active, cur_win, NULL);
|
window_choose_ready(wl->window->active, cur_win, NULL);
|
||||||
|
window_choose_collapse_all(wl->window->active);
|
||||||
|
|
||||||
if (args_has(args, 'u'))
|
if (args_has(args, 'u')) {
|
||||||
window_choose_expand_all(wl->window->active);
|
window_choose_expand_all(wl->window->active);
|
||||||
|
window_choose_set_current(wl->window->active, cur_win);
|
||||||
|
}
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
2
tmux.h
2
tmux.h
@ -2257,6 +2257,8 @@ struct window_choose_data *window_choose_add_item(struct window_pane *,
|
|||||||
struct client *, struct winlink *, const char *,
|
struct client *, struct winlink *, const char *,
|
||||||
const char *, u_int);
|
const char *, u_int);
|
||||||
void window_choose_expand_all(struct window_pane *);
|
void window_choose_expand_all(struct window_pane *);
|
||||||
|
void window_choose_collapse_all(struct window_pane *);
|
||||||
|
void window_choose_set_current(struct window_pane *, u_int);
|
||||||
|
|
||||||
/* names.c */
|
/* names.c */
|
||||||
void queue_window_name(struct window *);
|
void queue_window_name(struct window *);
|
||||||
|
@ -44,7 +44,6 @@ void window_choose_scroll_down(struct window_pane *);
|
|||||||
|
|
||||||
void window_choose_collapse(struct window_pane *, struct session *);
|
void window_choose_collapse(struct window_pane *, struct session *);
|
||||||
void window_choose_expand(struct window_pane *, struct session *, u_int);
|
void window_choose_expand(struct window_pane *, struct session *, u_int);
|
||||||
void window_choose_collapse_all(struct window_pane *);
|
|
||||||
|
|
||||||
enum window_choose_input_type {
|
enum window_choose_input_type {
|
||||||
WINDOW_CHOOSE_NORMAL = -1,
|
WINDOW_CHOOSE_NORMAL = -1,
|
||||||
@ -102,8 +101,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_choose_ready(struct window_pane *wp, u_int cur,
|
window_choose_set_current(struct window_pane *wp, u_int cur)
|
||||||
void (*callbackfn)(struct window_choose_data *))
|
|
||||||
{
|
{
|
||||||
struct window_choose_mode_data *data = wp->modedata;
|
struct window_choose_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
@ -112,12 +110,22 @@ window_choose_ready(struct window_pane *wp, u_int cur,
|
|||||||
if (data->selected > screen_size_y(s) - 1)
|
if (data->selected > screen_size_y(s) - 1)
|
||||||
data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s);
|
data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s);
|
||||||
|
|
||||||
|
window_choose_redraw_screen(wp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_choose_ready(struct window_pane *wp, u_int cur,
|
||||||
|
void (*callbackfn)(struct window_choose_data *))
|
||||||
|
{
|
||||||
|
struct window_choose_mode_data *data = wp->modedata;
|
||||||
|
|
||||||
data->callbackfn = callbackfn;
|
data->callbackfn = callbackfn;
|
||||||
if (data->callbackfn == NULL)
|
if (data->callbackfn == NULL)
|
||||||
data->callbackfn = window_choose_default_callback;
|
data->callbackfn = window_choose_default_callback;
|
||||||
|
|
||||||
ARRAY_CONCAT(&data->old_list, &data->list);
|
ARRAY_CONCAT(&data->old_list, &data->list);
|
||||||
|
|
||||||
|
window_choose_set_current(wp, cur);
|
||||||
window_choose_collapse_all(wp);
|
window_choose_collapse_all(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user