version 1.32, 2019/05/27 06:50:04 |
version 1.33, 2019/05/28 07:18:42 |
|
|
|
|
struct window_pane *wp; |
struct window_pane *wp; |
void *modedata; |
void *modedata; |
const char *menu; |
const struct menu_item *menu; |
|
|
const char **sort_list; |
const char **sort_list; |
u_int sort_size; |
u_int sort_size; |
|
|
|
|
static void mode_tree_free_items(struct mode_tree_list *); |
static void mode_tree_free_items(struct mode_tree_list *); |
|
|
#define MODE_TREE_MENU \ |
static const struct menu_item mode_tree_menu_items[] = { |
"Scroll Left,<,|" \ |
{ "Scroll Left", '<', NULL }, |
"Scroll Right,>,|" \ |
{ "Scroll Right", '>', NULL }, |
"|" \ |
{ "", KEYC_NONE, NULL }, |
"Cancel,q," |
{ "Cancel", 'q', NULL }, |
|
|
|
{ NULL, KEYC_NONE, NULL } |
|
}; |
|
|
static struct mode_tree_item * |
static struct mode_tree_item * |
mode_tree_find_item(struct mode_tree_list *mtl, uint64_t tag) |
mode_tree_find_item(struct mode_tree_list *mtl, uint64_t tag) |
{ |
{ |
|
|
mode_tree_start(struct window_pane *wp, struct args *args, |
mode_tree_start(struct window_pane *wp, struct args *args, |
mode_tree_build_cb buildcb, mode_tree_draw_cb drawcb, |
mode_tree_build_cb buildcb, mode_tree_draw_cb drawcb, |
mode_tree_search_cb searchcb, mode_tree_menu_cb menucb, void *modedata, |
mode_tree_search_cb searchcb, mode_tree_menu_cb menucb, void *modedata, |
const char *menu, const char **sort_list, u_int sort_size, |
const struct menu_item *menu, const char **sort_list, u_int sort_size, |
struct screen **s) |
struct screen **s) |
{ |
{ |
struct mode_tree_data *mtd; |
struct mode_tree_data *mtd; |
|
|
{ |
{ |
struct mode_tree_item *mti; |
struct mode_tree_item *mti; |
struct menu *menu; |
struct menu *menu; |
|
const struct menu_item *items; |
struct mode_tree_menu *mtm; |
struct mode_tree_menu *mtm; |
const char *s; |
|
char *title; |
char *title; |
u_int line; |
u_int line; |
|
|
|
|
mti = mtd->line_list[line].item; |
mti = mtd->line_list[line].item; |
|
|
if (!outside) { |
if (!outside) { |
s = mtd->menu; |
items = mtd->menu; |
xasprintf(&title, "#[align=centre]%s", mti->name); |
xasprintf(&title, "#[align=centre]%s", mti->name); |
} else { |
} else { |
s = MODE_TREE_MENU; |
items = mode_tree_menu_items; |
title = xstrdup(""); |
title = xstrdup(""); |
} |
} |
menu = menu_create(s, NULL, c, NULL, title); |
menu = menu_create(title); |
|
menu_add_items(menu, items, NULL, NULL, NULL); |
free(title); |
free(title); |
if (menu == NULL) |
|
return; |
|
|
|
mtm = xmalloc(sizeof *mtm); |
mtm = xmalloc(sizeof *mtm); |
mtm->data = mtd; |
mtm->data = mtd; |