tmux  3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
  Fossies Dox: tmux-3.2a.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mode-tree.c File Reference
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tmux.h"
Include dependency graph for mode-tree.c:

Go to the source code of this file.

Data Structures

struct  mode_tree_data
 
struct  mode_tree_item
 
struct  mode_tree_line
 
struct  mode_tree_menu
 

Functions

 TAILQ_HEAD (mode_tree_list, mode_tree_item)
 
static void mode_tree_free_items (struct mode_tree_list *)
 
static struct mode_tree_itemmode_tree_find_item (struct mode_tree_list *mtl, uint64_t tag)
 
static void mode_tree_free_item (struct mode_tree_item *mti)
 
static void mode_tree_check_selected (struct mode_tree_data *mtd)
 
static void mode_tree_clear_lines (struct mode_tree_data *mtd)
 
static void mode_tree_build_lines (struct mode_tree_data *mtd, struct mode_tree_list *mtl, u_int depth)
 
static void mode_tree_clear_tagged (struct mode_tree_list *mtl)
 
void mode_tree_up (struct mode_tree_data *mtd, int wrap)
 
void mode_tree_down (struct mode_tree_data *mtd, int wrap)
 
void * mode_tree_get_current (struct mode_tree_data *mtd)
 
const char * mode_tree_get_current_name (struct mode_tree_data *mtd)
 
void mode_tree_expand_current (struct mode_tree_data *mtd)
 
void mode_tree_collapse_current (struct mode_tree_data *mtd)
 
static int mode_tree_get_tag (struct mode_tree_data *mtd, uint64_t tag, u_int *found)
 
void mode_tree_expand (struct mode_tree_data *mtd, uint64_t tag)
 
int mode_tree_set_current (struct mode_tree_data *mtd, uint64_t tag)
 
u_int mode_tree_count_tagged (struct mode_tree_data *mtd)
 
void mode_tree_each_tagged (struct mode_tree_data *mtd, mode_tree_each_cb cb, struct client *c, key_code key, int current)
 
struct mode_tree_datamode_tree_start (struct window_pane *wp, struct args *args, mode_tree_build_cb buildcb, mode_tree_draw_cb drawcb, mode_tree_search_cb searchcb, mode_tree_menu_cb menucb, mode_tree_height_cb heightcb, mode_tree_key_cb keycb, void *modedata, const struct menu_item *menu, const char **sort_list, u_int sort_size, struct screen **s)
 
void mode_tree_zoom (struct mode_tree_data *mtd, struct args *args)
 
static void mode_tree_set_height (struct mode_tree_data *mtd)
 
void mode_tree_build (struct mode_tree_data *mtd)
 
static void mode_tree_remove_ref (struct mode_tree_data *mtd)
 
void mode_tree_free (struct mode_tree_data *mtd)
 
void mode_tree_resize (struct mode_tree_data *mtd, u_int sx, u_int sy)
 
struct mode_tree_itemmode_tree_add (struct mode_tree_data *mtd, struct mode_tree_item *parent, void *itemdata, uint64_t tag, const char *name, const char *text, int expanded)
 
void mode_tree_draw_as_parent (struct mode_tree_item *mti)
 
void mode_tree_no_tag (struct mode_tree_item *mti)
 
void mode_tree_remove (struct mode_tree_data *mtd, struct mode_tree_item *mti)
 
void mode_tree_draw (struct mode_tree_data *mtd)
 
static struct mode_tree_itemmode_tree_search_for (struct mode_tree_data *mtd)
 
static void mode_tree_search_set (struct mode_tree_data *mtd)
 
static int mode_tree_search_callback (struct client *c, void *data, const char *s, int done)
 
static void mode_tree_search_free (void *data)
 
static int mode_tree_filter_callback (struct client *c, void *data, const char *s, int done)
 
static void mode_tree_filter_free (void *data)
 
static void mode_tree_menu_callback (struct menu *menu, u_int idx, key_code key, void *data)
 
static void mode_tree_display_menu (struct mode_tree_data *mtd, struct client *c, u_int x, u_int y, int outside)
 
int mode_tree_key (struct mode_tree_data *mtd, struct client *c, key_code *key, struct mouse_event *m, u_int *xp, u_int *yp)
 
void mode_tree_run_command (struct client *c, struct cmd_find_state *fs, const char *template, const char *name)
 

Variables

static const struct menu_item mode_tree_menu_items []
 

Function Documentation

◆ mode_tree_add()

◆ mode_tree_build()

◆ mode_tree_build_lines()

◆ mode_tree_check_selected()

static void mode_tree_check_selected ( struct mode_tree_data mtd)
static

◆ mode_tree_clear_lines()

static void mode_tree_clear_lines ( struct mode_tree_data mtd)
static

Definition at line 171 of file mode-tree.c.

References mode_tree_data::line_list, and mode_tree_data::line_size.

Referenced by mode_tree_build(), and mode_tree_free().

◆ mode_tree_clear_tagged()

static void mode_tree_clear_tagged ( struct mode_tree_list *  mtl)
static

Definition at line 233 of file mode-tree.c.

References mode_tree_item::children, and mode_tree_item::tagged.

Referenced by mode_tree_key().

◆ mode_tree_collapse_current()

void mode_tree_collapse_current ( struct mode_tree_data mtd)

◆ mode_tree_count_tagged()

u_int mode_tree_count_tagged ( struct mode_tree_data mtd)

◆ mode_tree_display_menu()

◆ mode_tree_down()

void mode_tree_down ( struct mode_tree_data mtd,
int  wrap 
)

◆ mode_tree_draw()

void mode_tree_draw ( struct mode_tree_data mtd)

Definition at line 616 of file mode-tree.c.

References grid_cell::attr, grid_cell::bg, mode_tree_item::children, mode_tree_data::current, mode_tree_line::depth, mode_tree_item::draw_as_parent, mode_tree_data::drawcb, mode_tree_item::expanded, mode_tree_sort_criteria::field, mode_tree_data::filter, mode_tree_line::flat, format_draw(), GRID_ATTR_BRIGHT, grid_default_cell, mode_tree_data::height, mode_tree_line::item, mode_tree_item::itemdata, key, mode_tree_item::key, KEYC_NONE, mode_tree_item::keylen, mode_tree_item::keystr, mode_tree_line::last, mode_tree_item::line, mode_tree_data::line_list, mode_tree_data::line_size, mode_tree_data::modedata, mode_tree_item::name, mode_tree_data::no_matches, mode_tree_data::offset, window::options, mode_tree_item::parent, mode_tree_data::preview, mode_tree_sort_criteria::reversed, mode_tree_data::screen, screen_size_y, screen_write_box(), screen_write_clearendofline(), screen_write_clearscreen(), screen_write_cursormove(), screen_write_nputs(), screen_write_puts(), screen_write_start(), screen_write_stop(), mode_tree_data::sort_crit, mode_tree_data::sort_list, strlcat(), style_apply(), mode_tree_item::tagged, mode_tree_item::text, utf8_cstrwidth(), mode_tree_data::width, window_pane::window, mode_tree_data::wp, xasprintf(), xcalloc(), and xstrdup().

Referenced by mode_tree_filter_callback(), mode_tree_resize(), mode_tree_search_set(), window_buffer_edit_close_cb(), window_buffer_init(), window_buffer_key(), window_buffer_update(), window_client_init(), window_client_key(), window_client_update(), window_customize_change_current_callback(), window_customize_change_tagged_callback(), window_customize_init(), window_customize_key(), window_customize_set_command_callback(), window_customize_set_note_callback(), window_customize_set_option_callback(), window_tree_init(), and window_tree_update().

◆ mode_tree_draw_as_parent()

void mode_tree_draw_as_parent ( struct mode_tree_item mti)

Definition at line 592 of file mode-tree.c.

References mode_tree_item::draw_as_parent.

Referenced by window_customize_build_keys().

◆ mode_tree_each_tagged()

◆ mode_tree_expand()

void mode_tree_expand ( struct mode_tree_data mtd,
uint64_t  tag 
)

◆ mode_tree_expand_current()

void mode_tree_expand_current ( struct mode_tree_data mtd)

◆ mode_tree_filter_callback()

static int mode_tree_filter_callback ( struct client c,
void *  data,
const char *  s,
int  done 
)
static

◆ mode_tree_filter_free()

static void mode_tree_filter_free ( void *  data)
static

Definition at line 903 of file mode-tree.c.

References mode_tree_remove_ref().

Referenced by mode_tree_key().

◆ mode_tree_find_item()

static struct mode_tree_item* mode_tree_find_item ( struct mode_tree_list *  mtl,
uint64_t  tag 
)
static

Definition at line 122 of file mode-tree.c.

References mode_tree_item::children, and mode_tree_item::tag.

Referenced by mode_tree_add().

◆ mode_tree_free()

◆ mode_tree_free_item()

static void mode_tree_free_item ( struct mode_tree_item mti)
static

◆ mode_tree_free_items()

static void mode_tree_free_items ( struct mode_tree_list *  mtl)
static

Definition at line 149 of file mode-tree.c.

References mode_tree_free_item().

Referenced by mode_tree_build(), mode_tree_free(), and mode_tree_free_item().

◆ mode_tree_get_current()

◆ mode_tree_get_current_name()

const char* mode_tree_get_current_name ( struct mode_tree_data mtd)

◆ mode_tree_get_tag()

static int mode_tree_get_tag ( struct mode_tree_data mtd,
uint64_t  tag,
u_int *  found 
)
static

◆ mode_tree_key()

◆ mode_tree_menu_callback()

◆ mode_tree_no_tag()

void mode_tree_no_tag ( struct mode_tree_item mti)

Definition at line 598 of file mode-tree.c.

References mode_tree_item::no_tag.

Referenced by window_customize_build_keys(), and window_customize_build_options().

◆ mode_tree_remove()

void mode_tree_remove ( struct mode_tree_data mtd,
struct mode_tree_item mti 
)

◆ mode_tree_remove_ref()

static void mode_tree_remove_ref ( struct mode_tree_data mtd)
static

◆ mode_tree_resize()

◆ mode_tree_run_command()

void mode_tree_run_command ( struct client c,
struct cmd_find_state fs,
const char *  template,
const char *  name 
)

◆ mode_tree_search_callback()

static int mode_tree_search_callback ( struct client c,
void *  data,
const char *  s,
int  done 
)
static

Definition at line 854 of file mode-tree.c.

References mode_tree_data::dead, mode_tree_search_set(), mode_tree_data::search, and xstrdup().

Referenced by mode_tree_key().

◆ mode_tree_search_for()

◆ mode_tree_search_free()

static void mode_tree_search_free ( void *  data)
static

Definition at line 874 of file mode-tree.c.

References mode_tree_remove_ref().

Referenced by mode_tree_key().

◆ mode_tree_search_set()

◆ mode_tree_set_current()

int mode_tree_set_current ( struct mode_tree_data mtd,
uint64_t  tag 
)

◆ mode_tree_set_height()

static void mode_tree_set_height ( struct mode_tree_data mtd)
static

◆ mode_tree_start()

◆ mode_tree_up()

◆ mode_tree_zoom()

◆ TAILQ_HEAD()

TAILQ_HEAD ( mode_tree_list  ,
mode_tree_item   
)

Variable Documentation

◆ mode_tree_menu_items

const struct menu_item mode_tree_menu_items[]
static
Initial value:
= {
{ "Scroll Left", '<', NULL },
{ "Scroll Right", '>', NULL },
{ "", 0x000ff000000000ULL , NULL },
{ "Cancel", 'q', NULL },
{ NULL, 0x000ff000000000ULL , NULL }
}

Definition at line 110 of file mode-tree.c.

Referenced by mode_tree_display_menu().