diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-10-11 13:22:00 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-10-11 13:22:00 +0000 |
commit | 7b83048a3c6235e9f4996ad7cf1736535660de8d (patch) | |
tree | 0cfe4f046930fdf9eace502dffd0dd219c62670f /usr.bin | |
parent | 473fce65f32c28b7882490f2037e8241197ad7fa (diff) |
Add static in window-*.c and move some internal functions out of tmux.h.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/arguments.c | 29 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-queue.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/grid.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/names.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/screen.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/server-fn.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/session.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 23 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 17 | ||||
-rw-r--r-- | usr.bin/tmux/window-choose.c | 95 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 262 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 20 |
13 files changed, 248 insertions, 252 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c index 58ca4bedf05..8908224a333 100644 --- a/usr.bin/tmux/arguments.c +++ b/usr.bin/tmux/arguments.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arguments.c,v 1.14 2016/10/10 13:54:47 nicm Exp $ */ +/* $OpenBSD: arguments.c,v 1.15 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -35,6 +35,7 @@ struct args_entry { RB_ENTRY(args_entry) entry; }; +static void args_set(struct args *, u_char, const char *); static struct args_entry *args_find(struct args *, u_char); static int args_cmp(struct args_entry *, struct args_entry *); @@ -47,30 +48,6 @@ args_cmp(struct args_entry *a1, struct args_entry *a2) return (a1->flag - a2->flag); } -/* Create an arguments set with no flags. */ -struct args * -args_create(int argc, ...) -{ - struct args *args; - va_list ap; - int i; - - args = xcalloc(1, sizeof *args); - - args->argc = argc; - if (argc == 0) - args->argv = NULL; - else - args->argv = xcalloc(argc, sizeof *args->argv); - - va_start(ap, argc); - for (i = 0; i < argc; i++) - args->argv[i] = xstrdup(va_arg(ap, char *)); - va_end(ap); - - return (args); -} - /* Find a flag in the arguments tree. */ static struct args_entry * args_find(struct args *args, u_char ch) @@ -206,7 +183,7 @@ args_has(struct args *args, u_char ch) } /* Set argument value in the arguments tree. */ -void +static void args_set(struct args *args, u_char ch, const char *value) { struct args_entry *entry; diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index 561863e2c66..0824a425922 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.37 2016/09/28 14:40:07 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.38 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -26,6 +26,7 @@ #include "tmux.h" static enum cmd_retval cmdq_continue_one(struct cmd_q *); +static void cmdq_flush(struct cmd_q *); /* Create new command queue. */ struct cmd_q * @@ -319,7 +320,7 @@ out: } /* Flush command queue. */ -void +static void cmdq_flush(struct cmd_q *cmdq) { struct cmd_q_item *item, *item1; diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 2ea6162ad0e..4d56d85b6c3 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.56 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.57 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -43,6 +43,8 @@ const struct grid_cell_entry grid_default_entry = { 0, { .data = { 0, 8, 8, ' ' } } }; +static void grid_expand_line(struct grid *, u_int, u_int); + static void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *, u_int, u_int); static void grid_reflow_join(struct grid *, u_int *, struct grid_line *, @@ -50,6 +52,7 @@ static void grid_reflow_join(struct grid *, u_int *, struct grid_line *, static void grid_reflow_split(struct grid *, u_int *, struct grid_line *, u_int, u_int); static void grid_reflow_move(struct grid *, u_int *, struct grid_line *); + static size_t grid_string_cells_fg(const struct grid_cell *, int *); static size_t grid_string_cells_bg(const struct grid_cell *, int *); static void grid_string_cells_code(const struct grid_cell *, @@ -243,7 +246,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower) } /* Expand line to fit to cell. */ -void +static void grid_expand_line(struct grid *gd, u_int py, u_int sx) { struct grid_line *gl; diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index 15c0ad00227..8e2a783fefd 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.36 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.37 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -25,8 +25,10 @@ #include "tmux.h" -static void name_time_callback(int, short, void *); -static int name_time_expired(struct window *, struct timeval *); +static void name_time_callback(int, short, void *); +static int name_time_expired(struct window *, struct timeval *); + +static char *format_window_name(struct window *); static void name_time_callback(__unused int fd, __unused short events, void *arg) @@ -115,7 +117,7 @@ default_window_name(struct window *w) return (s); } -char * +static char * format_window_name(struct window *w) { struct format_tree *ft; diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index febe5795166..f715ecb4426 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.41 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.42 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -27,6 +27,8 @@ static void screen_resize_x(struct screen *, u_int); static void screen_resize_y(struct screen *, u_int); +static void screen_reflow(struct screen *, u_int); + /* Create a new screen. */ void screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) @@ -370,7 +372,7 @@ screen_check_selection(struct screen *s, u_int px, u_int py) } /* Reflow wrapped lines. */ -void +static void screen_reflow(struct screen *s, u_int new_x) { struct grid *old = s->grid; diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 60d088dc37e..0167da802ff 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.100 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.101 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -30,6 +30,7 @@ static struct session *server_next_session(struct session *); static void server_callback_identify(int, short, void *); +static void server_destroy_session_group(struct session *); void server_fill_environ(struct session *s, struct environ *env) @@ -339,7 +340,7 @@ server_destroy_pane(struct window_pane *wp, int hooks) server_redraw_window(w); } -void +static void server_destroy_session_group(struct session *s) { struct session_group *sg; diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 98813bdc357..737979c93bd 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.63 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.64 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -38,6 +38,10 @@ static void session_lock_timer(int, short, void *); static struct winlink *session_next_alert(struct winlink *); static struct winlink *session_previous_alert(struct winlink *); +static void session_group_remove(struct session *); +static u_int session_group_count(struct session_group *); +static void session_group_synchronize1(struct session *, struct session *); + RB_GENERATE(sessions, session, entry, session_cmp); int @@ -582,7 +586,7 @@ session_group_add(struct session *target, struct session *s) } /* Remove a session from its group and destroy the group if empty. */ -void +static void session_group_remove(struct session *s) { struct session_group *sg; @@ -599,7 +603,7 @@ session_group_remove(struct session *s) } /* Count number of sessions in session group. */ -u_int +static u_int session_group_count(struct session_group *sg) { struct session *s; @@ -650,7 +654,7 @@ session_group_synchronize_from(struct session *target) * winlinks then recreating them, then updating the current window, last window * stack and alerts. */ -void +static void session_group_synchronize1(struct session *target, struct session *s) { struct winlinks old_windows, *ww; diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 107a961aebd..53dee059c31 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.171 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.172 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -47,6 +47,9 @@ const char *socket_path; static __dead void usage(void); static char *make_label(const char *); +static const char *getshell(void); +static int checkshell(const char *); + static __dead void usage(void) { @@ -57,7 +60,7 @@ usage(void) exit(1); } -const char * +static const char * getshell(void) { struct passwd *pw; @@ -74,7 +77,7 @@ getshell(void) return (_PATH_BSHELL); } -int +static int checkshell(const char *shell) { if (shell == NULL || *shell == '\0' || *shell != '/') diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 8c7e8228ce1..14018fa0773 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.653 2016/10/11 09:30:36 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.654 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1520,8 +1520,6 @@ extern struct options *global_w_options; extern struct environ *global_environ; extern struct timeval start_time; extern const char *socket_path; -const char *getshell(void); -int checkshell(const char *); int areshell(const char *); void setblocking(int, int); const char *find_home(void); @@ -1681,14 +1679,11 @@ void environ_log(struct environ *, const char *); /* tty.c */ void tty_create_log(void); -void tty_init_termios(int, struct termios *, struct bufferevent *); void tty_raw(struct tty *, const char *); void tty_attributes(struct tty *, const struct grid_cell *, const struct window_pane *); void tty_reset(struct tty *); -void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int); void tty_region(struct tty *, u_int, u_int); -void tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int, u_int); void tty_cursor(struct tty *, u_int, u_int); void tty_putcode(struct tty *, enum tty_code_code); void tty_putcode1(struct tty *, enum tty_code_code, int); @@ -1706,7 +1701,6 @@ void tty_start_tty(struct tty *); void tty_stop_tty(struct tty *); void tty_set_title(struct tty *, const char *); void tty_update_mode(struct tty *, int, struct screen *); -void tty_force_cursor_colour(struct tty *, const char *); void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int, u_int); void tty_draw_line(struct tty *, const struct window_pane *, struct screen *, @@ -1763,12 +1757,10 @@ void tty_keys_free(struct tty *); key_code tty_keys_next(struct tty *); /* arguments.c */ -struct args *args_create(int, ...); struct args *args_parse(const char *, int, char **); void args_free(struct args *); char *args_print(struct args *); int args_has(struct args *, u_char); -void args_set(struct args *, u_char, const char *); const char *args_get(struct args *, u_char); long long args_strtonum(struct args *, u_char, long long, long long, char **); @@ -1832,7 +1824,6 @@ void cmdq_run(struct cmd_q *, struct cmd_list *, void cmdq_append(struct cmd_q *, struct cmd_list *, struct mouse_event *); int cmdq_continue(struct cmd_q *); -void cmdq_flush(struct cmd_q *); /* cmd-string.c */ int cmd_string_parse(const char *, struct cmd_list **, const char *, @@ -1916,7 +1907,6 @@ int server_link_window(struct session *, struct winlink *, struct session *, int, int, int, char **); void server_unlink_window(struct session *, struct winlink *); void server_destroy_pane(struct window_pane *, int); -void server_destroy_session_group(struct session *); void server_destroy_session(struct session *); void server_check_unattached(void); void server_set_identify(struct client *); @@ -1982,7 +1972,6 @@ void grid_collect_history(struct grid *); void grid_scroll_history(struct grid *); void grid_scroll_history_region(struct grid *, u_int, u_int); void grid_clear_history(struct grid *); -void grid_expand_line(struct grid *, u_int, u_int); const struct grid_line *grid_peek_line(struct grid *, u_int); void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *); void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *); @@ -2078,7 +2067,6 @@ void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int, u_int, struct grid_cell *); void screen_clear_selection(struct screen *); int screen_check_selection(struct screen *, u_int, u_int); -void screen_reflow(struct screen *, u_int); /* window.c */ extern struct windows windows; @@ -2092,7 +2080,6 @@ RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp); struct winlink *winlink_find_by_index(struct winlinks *, int); struct winlink *winlink_find_by_window(struct winlinks *, struct window *); struct winlink *winlink_find_by_window_id(struct winlinks *, u_int); -int winlink_next_index(struct winlinks *, int); u_int winlink_count(struct winlinks *); struct winlink *winlink_add(struct winlinks *, int); void winlink_set_window(struct winlink *, struct window *); @@ -2136,8 +2123,6 @@ u_int window_count_panes(struct window *); void window_destroy_panes(struct window *); struct window_pane *window_pane_find_by_id_str(const char *); struct window_pane *window_pane_find_by_id(u_int); -struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int); -void window_pane_destroy(struct window_pane *); int window_pane_spawn(struct window_pane *, int, char **, const char *, const char *, const char *, struct environ *, struct termios *, char **); @@ -2223,7 +2208,6 @@ void window_choose_ready(struct window_pane *, u_int, void (*)(struct window_choose_data *)); struct window_choose_data *window_choose_data_create (int, struct client *, struct session *); -void window_choose_data_free(struct window_choose_data *); void window_choose_data_run(struct window_choose_data *); struct window_choose_data *window_choose_add_window(struct window_pane *, struct client *, struct session *, struct winlink *, @@ -2232,13 +2216,11 @@ struct window_choose_data *window_choose_add_session(struct window_pane *, struct client *, struct session *, const char *, const char *, u_int); 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 */ void check_window_name(struct window *); char *default_window_name(struct window *); -char *format_window_name(struct window *); char *parse_window_name(const char *); /* signal.c */ @@ -2295,11 +2277,8 @@ int session_set_current(struct session *, struct winlink *); struct session_group *session_group_find(struct session *); u_int session_group_index(struct session_group *); void session_group_add(struct session *, struct session *); -void session_group_remove(struct session *); -u_int session_group_count(struct session_group *); void session_group_synchronize_to(struct session *); void session_group_synchronize_from(struct session *); -void session_group_synchronize1(struct session *, struct session *); void session_renumber_windows(struct session *); /* utf8.c */ diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index c0d45813ac1..40dc0c47394 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.207 2016/10/10 21:29:23 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.208 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -33,6 +33,8 @@ static int tty_log_fd = -1; +static void tty_init_termios(int, struct termios *, struct bufferevent *); + static void tty_read_callback(struct bufferevent *, void *); static void tty_error_callback(struct bufferevent *, short, void *); @@ -40,6 +42,9 @@ static int tty_client_ready(struct client *, struct window_pane *); static void tty_set_italics(struct tty *); static int tty_try_colour(struct tty *, int, const char *); +static void tty_force_cursor_colour(struct tty *, const char *); +static void tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int, + u_int); static void tty_colours(struct tty *, const struct grid_cell *); static void tty_check_fg(struct tty *, struct grid_cell *); @@ -47,6 +52,8 @@ static void tty_check_bg(struct tty *, struct grid_cell *); static void tty_colours_fg(struct tty *, const struct grid_cell *); static void tty_colours_bg(struct tty *, const struct grid_cell *); +static void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, + u_int); static int tty_large_region(struct tty *, const struct tty_ctx *); static int tty_fake_bce(const struct tty *, const struct window_pane *); static void tty_redraw_region(struct tty *, const struct tty_ctx *); @@ -189,7 +196,7 @@ tty_error_callback(__unused struct bufferevent *bufev, __unused short what, { } -void +static void tty_init_termios(int fd, struct termios *orig_tio, struct bufferevent *bufev) { struct termios tio; @@ -478,7 +485,7 @@ tty_set_title(struct tty *tty, const char *title) tty_putcode(tty, TTYC_FSL); } -void +static void tty_force_cursor_colour(struct tty *tty, const char *ccolour) { if (*ccolour == '\0') @@ -1182,7 +1189,7 @@ tty_reset(struct tty *tty) } /* Set region inside pane. */ -void +static void tty_region_pane(struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower) { @@ -1215,7 +1222,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower) } /* Move cursor inside pane. */ -void +static void tty_cursor_pane(struct tty *tty, const struct tty_ctx *ctx, u_int cx, u_int cy) { tty_cursor(tty, ctx->xoff + cx, ctx->yoff + cy); diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c index eb32bf56788..9ea4d8bdf98 100644 --- a/usr.bin/tmux/window-choose.c +++ b/usr.bin/tmux/window-choose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-choose.c,v 1.78 2016/10/11 07:23:34 nicm Exp $ */ +/* $OpenBSD: window-choose.c,v 1.79 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -24,27 +24,32 @@ #include "tmux.h" -struct screen *window_choose_init(struct window_pane *); -void window_choose_free(struct window_pane *); -void window_choose_resize(struct window_pane *, u_int, u_int); -void window_choose_key(struct window_pane *, struct client *, - struct session *, key_code, struct mouse_event *); +static struct screen *window_choose_init(struct window_pane *); +static void window_choose_free(struct window_pane *); +static void window_choose_resize(struct window_pane *, u_int, u_int); +static void window_choose_key(struct window_pane *, struct client *, + struct session *, key_code, struct mouse_event *); -void window_choose_default_callback(struct window_choose_data *); -struct window_choose_mode_item *window_choose_get_item(struct window_pane *, - key_code, struct mouse_event *); +static void window_choose_default_callback(struct window_choose_data *); +static struct window_choose_mode_item *window_choose_get_item( + struct window_pane *, key_code, struct mouse_event *); -void window_choose_fire_callback(struct window_pane *, - struct window_choose_data *); -void window_choose_redraw_screen(struct window_pane *); -void window_choose_write_line(struct window_pane *, - struct screen_write_ctx *, u_int); +static void window_choose_fire_callback(struct window_pane *, + struct window_choose_data *); +static void window_choose_redraw_screen(struct window_pane *); +static void window_choose_write_line(struct window_pane *, + struct screen_write_ctx *, u_int); -void window_choose_scroll_up(struct window_pane *); -void window_choose_scroll_down(struct window_pane *); +static void window_choose_scroll_up(struct window_pane *); +static void window_choose_scroll_down(struct window_pane *); -void window_choose_collapse(struct window_pane *, struct session *, u_int); -void window_choose_expand(struct window_pane *, struct session *, u_int); +static void window_choose_collapse(struct window_pane *, struct session *, + u_int); +static void window_choose_expand(struct window_pane *, struct session *, + u_int); +static void window_choose_collapse_all(struct window_pane *); + +static void window_choose_data_free(struct window_choose_data *); enum window_choose_input_type { WINDOW_CHOOSE_NORMAL = -1, @@ -86,12 +91,14 @@ struct window_choose_mode_data { void (*callbackfn)(struct window_choose_data *); }; -void window_choose_free1(struct window_choose_mode_data *); -int window_choose_key_index(struct window_choose_mode_data *, u_int); -int window_choose_index_key(struct window_choose_mode_data *, key_code); -void window_choose_prompt_input(enum window_choose_input_type, - const char *, struct window_pane *, key_code); -void window_choose_reset_top(struct window_pane *, u_int); +static void window_choose_free1(struct window_choose_mode_data *); +static int window_choose_key_index(struct window_choose_mode_data *, + u_int); +static int window_choose_index_key(struct window_choose_mode_data *, + key_code); +static void window_choose_prompt_input(enum window_choose_input_type, + const char *, struct window_pane *, key_code); +static void window_choose_reset_top(struct window_pane *, u_int); void window_choose_add(struct window_pane *wp, struct window_choose_data *wcd) @@ -122,7 +129,7 @@ window_choose_set_current(struct window_pane *wp, u_int cur) window_choose_reset_top(wp, screen_size_y(s)); } -void +static void window_choose_reset_top(struct window_pane *wp, u_int sy) { struct window_choose_mode_data *data = wp->modedata; @@ -156,7 +163,7 @@ window_choose_ready(struct window_pane *wp, u_int cur, window_choose_collapse_all(wp); } -struct screen * +static struct screen * window_choose_init(struct window_pane *wp) { struct window_choose_mode_data *data; @@ -218,7 +225,7 @@ window_choose_data_create(int type, struct client *c, struct session *s) return (wcd); } -void +static void window_choose_data_free(struct window_choose_data *wcd) { server_client_unref(wcd->start_client); @@ -260,7 +267,7 @@ window_choose_data_run(struct window_choose_data *cdata) cmd_list_free(cmdlist); } -void +static void window_choose_default_callback(struct window_choose_data *wcd) { if (wcd == NULL) @@ -271,14 +278,14 @@ window_choose_default_callback(struct window_choose_data *wcd) window_choose_data_run(wcd); } -void +static void window_choose_free(struct window_pane *wp) { if (wp->modedata != NULL) window_choose_free1(wp->modedata); } -void +static void window_choose_free1(struct window_choose_mode_data *data) { struct window_choose_mode_item *item; @@ -301,7 +308,7 @@ window_choose_free1(struct window_choose_mode_data *data) free(data); } -void +static void window_choose_resize(struct window_pane *wp, u_int sx, u_int sy) { struct window_choose_mode_data *data = wp->modedata; @@ -312,7 +319,7 @@ window_choose_resize(struct window_pane *wp, u_int sx, u_int sy) window_choose_redraw_screen(wp); } -void +static void window_choose_fire_callback(struct window_pane *wp, struct window_choose_data *wcd) { @@ -326,7 +333,7 @@ window_choose_fire_callback(struct window_pane *wp, window_choose_free1(data); } -void +static void window_choose_prompt_input(enum window_choose_input_type input_type, const char *prompt, struct window_pane *wp, key_code key) { @@ -344,7 +351,7 @@ window_choose_prompt_input(enum window_choose_input_type input_type, window_choose_redraw_screen(wp); } -void +static void window_choose_collapse(struct window_pane *wp, struct session *s, u_int pos) { struct window_choose_mode_data *data = wp->modedata; @@ -395,7 +402,7 @@ window_choose_collapse(struct window_pane *wp, struct session *s, u_int pos) } } -void +static void window_choose_collapse_all(struct window_pane *wp) { struct window_choose_mode_data *data = wp->modedata; @@ -446,7 +453,7 @@ window_choose_expand_all(struct window_pane *wp) window_choose_reset_top(wp, screen_size_y(scr)); } -void +static void window_choose_expand(struct window_pane *wp, struct session *s, u_int pos) { struct window_choose_mode_data *data = wp->modedata; @@ -518,7 +525,7 @@ window_choose_expand(struct window_pane *wp, struct session *s, u_int pos) } } -struct window_choose_mode_item * +static struct window_choose_mode_item * window_choose_get_item(struct window_pane *wp, key_code key, struct mouse_event *m) { @@ -537,7 +544,7 @@ window_choose_get_item(struct window_pane *wp, key_code key, return (&data->list[idx]); } -void +static void window_choose_key(struct window_pane *wp, __unused struct client *c, __unused struct session *sess, key_code key, struct mouse_event *m) { @@ -769,7 +776,7 @@ window_choose_key(struct window_pane *wp, __unused struct client *c, } } -void +static void window_choose_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_int py) { @@ -827,7 +834,7 @@ window_choose_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, } -int +static int window_choose_key_index(struct window_choose_mode_data *data, u_int idx) { static const char keys[] = "0123456789" @@ -846,7 +853,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx) return (-1); } -int +static int window_choose_index_key(struct window_choose_mode_data *data, key_code key) { static const char keys[] = "0123456789" @@ -867,7 +874,7 @@ window_choose_index_key(struct window_choose_mode_data *data, key_code key) return (-1); } -void +static void window_choose_redraw_screen(struct window_pane *wp) { struct window_choose_mode_data *data = wp->modedata; @@ -881,7 +888,7 @@ window_choose_redraw_screen(struct window_pane *wp) screen_write_stop(&ctx); } -void +static void window_choose_scroll_up(struct window_pane *wp) { struct window_choose_mode_data *data = wp->modedata; @@ -900,7 +907,7 @@ window_choose_scroll_up(struct window_pane *wp) screen_write_stop(&ctx); } -void +static void window_choose_scroll_down(struct window_pane *wp) { struct window_choose_mode_data *data = wp->modedata; diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 07e8cbb7f8a..876adc45856 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.156 2016/10/11 09:30:36 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.157 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -24,76 +24,82 @@ #include "tmux.h" -const char *window_copy_key_table(struct window_pane *); -void window_copy_command(struct window_pane *, struct client *, - struct session *, struct args *, struct mouse_event *); -struct screen *window_copy_init(struct window_pane *); -void window_copy_free(struct window_pane *); -void window_copy_pagedown(struct window_pane *, int); -void window_copy_next_paragraph(struct window_pane *); -void window_copy_previous_paragraph(struct window_pane *); -void window_copy_resize(struct window_pane *, u_int, u_int); - -void window_copy_redraw_selection(struct window_pane *, u_int); -void window_copy_redraw_lines(struct window_pane *, u_int, u_int); -void window_copy_redraw_screen(struct window_pane *); -void window_copy_write_line(struct window_pane *, struct screen_write_ctx *, - u_int); -void window_copy_write_lines(struct window_pane *, - struct screen_write_ctx *, u_int, u_int); - -void window_copy_scroll_to(struct window_pane *, u_int, u_int); -int window_copy_search_compare(struct grid *, u_int, u_int, struct grid *, - u_int, int); -int window_copy_search_lr(struct grid *, struct grid *, u_int *, u_int, - u_int, u_int, int); -int window_copy_search_rl(struct grid *, struct grid *, u_int *, u_int, - u_int, u_int, int); -void window_copy_move_left(struct screen *, u_int *, u_int *); -void window_copy_move_right(struct screen *, u_int *, u_int *); -int window_copy_is_lowercase(const char *); -void window_copy_search_jump(struct window_pane *, struct grid *, - struct grid *, u_int, u_int, u_int, int, int, int); -void window_copy_search(struct window_pane *, const char *, int, int); -void window_copy_search_up(struct window_pane *, const char *, int); -void window_copy_search_down(struct window_pane *, const char *, int); -void window_copy_goto_line(struct window_pane *, const char *); -void window_copy_update_cursor(struct window_pane *, u_int, u_int); -void window_copy_start_selection(struct window_pane *); -int window_copy_update_selection(struct window_pane *, int); -void *window_copy_get_selection(struct window_pane *, size_t *); -void window_copy_copy_buffer(struct window_pane *, const char *, void *, - size_t); -void window_copy_copy_pipe(struct window_pane *, struct session *, - const char *, const char *); -void window_copy_copy_selection(struct window_pane *, const char *); -void window_copy_append_selection(struct window_pane *, const char *); -void window_copy_clear_selection(struct window_pane *); -void window_copy_copy_line(struct window_pane *, char **, size_t *, u_int, - u_int, u_int); -int window_copy_in_set(struct window_pane *, u_int, u_int, const char *); -u_int window_copy_find_length(struct window_pane *, u_int); -void window_copy_cursor_start_of_line(struct window_pane *); -void window_copy_cursor_back_to_indentation(struct window_pane *); -void window_copy_cursor_end_of_line(struct window_pane *); -void window_copy_other_end(struct window_pane *); -void window_copy_cursor_left(struct window_pane *); -void window_copy_cursor_right(struct window_pane *); -void window_copy_cursor_up(struct window_pane *, int); -void window_copy_cursor_down(struct window_pane *, int); -void window_copy_cursor_jump(struct window_pane *); -void window_copy_cursor_jump_back(struct window_pane *); -void window_copy_cursor_jump_to(struct window_pane *, int); -void window_copy_cursor_jump_to_back(struct window_pane *, int); -void window_copy_cursor_next_word(struct window_pane *, const char *); -void window_copy_cursor_next_word_end(struct window_pane *, const char *); -void window_copy_cursor_previous_word(struct window_pane *, const char *); -void window_copy_scroll_up(struct window_pane *, u_int); -void window_copy_scroll_down(struct window_pane *, u_int); -void window_copy_rectangle_toggle(struct window_pane *); -void window_copy_move_mouse(struct mouse_event *); -void window_copy_drag_update(struct client *, struct mouse_event *); -void window_copy_drag_release(struct client *, struct mouse_event *); +static const char *window_copy_key_table(struct window_pane *); +static void window_copy_command(struct window_pane *, struct client *, + struct session *, struct args *, struct mouse_event *); +static struct screen *window_copy_init(struct window_pane *); +static void window_copy_free(struct window_pane *); +static void window_copy_pagedown(struct window_pane *, int); +static void window_copy_next_paragraph(struct window_pane *); +static void window_copy_previous_paragraph(struct window_pane *); +static void window_copy_resize(struct window_pane *, u_int, u_int); + +static void window_copy_redraw_selection(struct window_pane *, u_int); +static void window_copy_redraw_lines(struct window_pane *, u_int, u_int); +static void window_copy_redraw_screen(struct window_pane *); +static void window_copy_write_line(struct window_pane *, + struct screen_write_ctx *, u_int); +static void window_copy_write_lines(struct window_pane *, + struct screen_write_ctx *, u_int, u_int); + +static void window_copy_scroll_to(struct window_pane *, u_int, u_int); +static int window_copy_search_compare(struct grid *, u_int, u_int, + struct grid *, u_int, int); +static int window_copy_search_lr(struct grid *, struct grid *, u_int *, + u_int, u_int, u_int, int); +static int window_copy_search_rl(struct grid *, struct grid *, u_int *, + u_int, u_int, u_int, int); +static void window_copy_move_left(struct screen *, u_int *, u_int *); +static void window_copy_move_right(struct screen *, u_int *, u_int *); +static int window_copy_is_lowercase(const char *); +static void window_copy_search_jump(struct window_pane *, struct grid *, + struct grid *, u_int, u_int, u_int, int, int, int); +static void window_copy_search(struct window_pane *, const char *, int, + int); +static void window_copy_search_up(struct window_pane *, const char *, int); +static void window_copy_search_down(struct window_pane *, const char *, + int); +static void window_copy_goto_line(struct window_pane *, const char *); +static void window_copy_update_cursor(struct window_pane *, u_int, u_int); +static void window_copy_start_selection(struct window_pane *); +static int window_copy_update_selection(struct window_pane *, int); +static void *window_copy_get_selection(struct window_pane *, size_t *); +static void window_copy_copy_buffer(struct window_pane *, const char *, + void *, size_t); +static void window_copy_copy_pipe(struct window_pane *, struct session *, + const char *, const char *); +static void window_copy_copy_selection(struct window_pane *, const char *); +static void window_copy_append_selection(struct window_pane *, + const char *); +static void window_copy_clear_selection(struct window_pane *); +static void window_copy_copy_line(struct window_pane *, char **, size_t *, + u_int, u_int, u_int); +static int window_copy_in_set(struct window_pane *, u_int, u_int, + const char *); +static u_int window_copy_find_length(struct window_pane *, u_int); +static void window_copy_cursor_start_of_line(struct window_pane *); +static void window_copy_cursor_back_to_indentation(struct window_pane *); +static void window_copy_cursor_end_of_line(struct window_pane *); +static void window_copy_other_end(struct window_pane *); +static void window_copy_cursor_left(struct window_pane *); +static void window_copy_cursor_right(struct window_pane *); +static void window_copy_cursor_up(struct window_pane *, int); +static void window_copy_cursor_down(struct window_pane *, int); +static void window_copy_cursor_jump(struct window_pane *); +static void window_copy_cursor_jump_back(struct window_pane *); +static void window_copy_cursor_jump_to(struct window_pane *, int); +static void window_copy_cursor_jump_to_back(struct window_pane *, int); +static void window_copy_cursor_next_word(struct window_pane *, + const char *); +static void window_copy_cursor_next_word_end(struct window_pane *, + const char *); +static void window_copy_cursor_previous_word(struct window_pane *, + const char *); +static void window_copy_scroll_up(struct window_pane *, u_int); +static void window_copy_scroll_down(struct window_pane *, u_int); +static void window_copy_rectangle_toggle(struct window_pane *); +static void window_copy_move_mouse(struct mouse_event *); +static void window_copy_drag_update(struct client *, struct mouse_event *); const struct window_mode window_copy_mode = { .init = window_copy_init, @@ -156,7 +162,7 @@ struct window_copy_mode_data { char jumpchar; }; -struct screen * +static struct screen * window_copy_init(struct window_pane *wp) { struct window_copy_mode_data *data; @@ -229,7 +235,7 @@ window_copy_init_for_output(struct window_pane *wp) screen_size_y(&wp->base), UINT_MAX); } -void +static void window_copy_free(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -347,7 +353,7 @@ window_copy_pageup(struct window_pane *wp, int half_page) window_copy_redraw_screen(wp); } -void +static void window_copy_pagedown(struct window_pane *wp, int half_page) { struct window_copy_mode_data *data = wp->modedata; @@ -395,7 +401,7 @@ window_copy_pagedown(struct window_pane *wp, int half_page) window_copy_redraw_screen(wp); } -void +static void window_copy_previous_paragraph(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -412,7 +418,7 @@ window_copy_previous_paragraph(struct window_pane *wp) window_copy_scroll_to(wp, 0, oy); } -void +static void window_copy_next_paragraph(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -432,7 +438,7 @@ window_copy_next_paragraph(struct window_pane *wp) window_copy_scroll_to(wp, ox, oy); } -void +static void window_copy_resize(struct window_pane *wp, u_int sx, u_int sy) { struct window_copy_mode_data *data = wp->modedata; @@ -459,7 +465,7 @@ window_copy_resize(struct window_pane *wp, u_int sx, u_int sy) window_copy_redraw_screen(wp); } -const char * +static const char * window_copy_key_table(struct window_pane *wp) { if (options_get_number(wp->window->options, "mode-keys") == MODEKEY_VI) @@ -467,7 +473,7 @@ window_copy_key_table(struct window_pane *wp) return ("copy-mode"); } -void +static void window_copy_command(struct window_pane *wp, struct client *c, struct session *s, struct args *args, struct mouse_event *m) { @@ -803,7 +809,7 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s, wp->modeprefix = 1; } -void +static void window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py) { struct window_copy_mode_data *data = wp->modedata; @@ -829,7 +835,7 @@ window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py) window_copy_redraw_screen(wp); } -int +static int window_copy_search_compare(struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx, int cis) { @@ -850,7 +856,7 @@ window_copy_search_compare(struct grid *gd, u_int px, u_int py, return (memcmp(ud->data, sud->data, ud->size) == 0); } -int +static int window_copy_search_lr(struct grid *gd, struct grid *sgd, u_int *ppx, u_int py, u_int first, u_int last, int cis) { @@ -875,7 +881,7 @@ window_copy_search_lr(struct grid *gd, return (0); } -int +static int window_copy_search_rl(struct grid *gd, struct grid *sgd, u_int *ppx, u_int py, u_int first, u_int last, int cis) { @@ -900,7 +906,7 @@ window_copy_search_rl(struct grid *gd, return (0); } -void +static void window_copy_move_left(struct screen *s, u_int *fx, u_int *fy) { if (*fx == 0) { /* left */ @@ -912,7 +918,7 @@ window_copy_move_left(struct screen *s, u_int *fx, u_int *fy) *fx = *fx - 1; } -void +static void window_copy_move_right(struct screen *s, u_int *fx, u_int *fy) { if (*fx == screen_size_x(s) - 1) { /* right */ @@ -924,7 +930,7 @@ window_copy_move_right(struct screen *s, u_int *fx, u_int *fy) *fx = *fx + 1; } -int +static int window_copy_is_lowercase(const char *ptr) { while (*ptr != '\0') { @@ -941,7 +947,7 @@ window_copy_is_lowercase(const char *ptr) * up, down otherwise. If wrap then go to begin/end of grid and try again if * not found. */ -void +static void window_copy_search_jump(struct window_pane *wp, struct grid *gd, struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap, int direction) @@ -984,7 +990,7 @@ window_copy_search_jump(struct window_pane *wp, struct grid *gd, * down. If moveflag is 0 then look for string at the current cursor position * as well. */ -void +static void window_copy_search(struct window_pane *wp, const char *searchstr, int direction, int moveflag) { @@ -1024,21 +1030,21 @@ window_copy_search(struct window_pane *wp, const char *searchstr, int direction, screen_free(&ss); } -void +static void window_copy_search_up(struct window_pane *wp, const char *searchstr, int moveflag) { window_copy_search(wp, searchstr, 0, moveflag); } -void +static void window_copy_search_down(struct window_pane *wp, const char *searchstr, int moveflag) { window_copy_search(wp, searchstr, 1, moveflag); } -void +static void window_copy_goto_line(struct window_pane *wp, const char *linestr) { struct window_copy_mode_data *data = wp->modedata; @@ -1054,7 +1060,7 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr) window_copy_redraw_screen(wp); } -void +static void window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_int py) { @@ -1092,7 +1098,7 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, } } -void +static void window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx, u_int py, u_int ny) { @@ -1102,7 +1108,7 @@ window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx, window_copy_write_line(wp, ctx, py); } -void +static void window_copy_redraw_selection(struct window_pane *wp, u_int old_y) { struct window_copy_mode_data *data = wp->modedata; @@ -1119,7 +1125,7 @@ window_copy_redraw_selection(struct window_pane *wp, u_int old_y) window_copy_redraw_lines(wp, start, end - start + 1); } -void +static void window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny) { struct window_copy_mode_data *data = wp->modedata; @@ -1133,7 +1139,7 @@ window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny) screen_write_stop(&ctx); } -void +static void window_copy_redraw_screen(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1141,7 +1147,7 @@ window_copy_redraw_screen(struct window_pane *wp) window_copy_redraw_lines(wp, 0, screen_size_y(&data->screen)); } -void +static void window_copy_update_cursor(struct window_pane *wp, u_int cx, u_int cy) { struct window_copy_mode_data *data = wp->modedata; @@ -1162,7 +1168,7 @@ window_copy_update_cursor(struct window_pane *wp, u_int cx, u_int cy) } } -void +static void window_copy_start_selection(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1175,7 +1181,7 @@ window_copy_start_selection(struct window_pane *wp) window_copy_update_selection(wp, 1); } -int +static int window_copy_update_selection(struct window_pane *wp, int may_redraw) { struct window_copy_mode_data *data = wp->modedata; @@ -1227,7 +1233,7 @@ window_copy_update_selection(struct window_pane *wp, int may_redraw) return (1); } -void * +static void * window_copy_get_selection(struct window_pane *wp, size_t *len) { struct window_copy_mode_data *data = wp->modedata; @@ -1333,7 +1339,7 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) return (buf); } -void +static void window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf, size_t len) { @@ -1349,7 +1355,7 @@ window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf, free(buf); } -void +static void window_copy_copy_pipe(struct window_pane *wp, struct session *sess, const char *bufname, const char *arg) { @@ -1376,7 +1382,7 @@ window_copy_copy_pipe(struct window_pane *wp, struct session *sess, window_copy_copy_buffer(wp, bufname, buf, len); } -void +static void window_copy_copy_selection(struct window_pane *wp, const char *bufname) { void *buf; @@ -1389,7 +1395,7 @@ window_copy_copy_selection(struct window_pane *wp, const char *bufname) window_copy_copy_buffer(wp, bufname, buf, len); } -void +static void window_copy_append_selection(struct window_pane *wp, const char *bufname) { char *buf; @@ -1423,7 +1429,7 @@ window_copy_append_selection(struct window_pane *wp, const char *bufname) free(buf); } -void +static void window_copy_copy_line(struct window_pane *wp, char **buf, size_t *off, u_int sy, u_int sx, u_int ex) { @@ -1483,7 +1489,7 @@ window_copy_copy_line(struct window_pane *wp, char **buf, size_t *off, u_int sy, } } -void +static void window_copy_clear_selection(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1497,7 +1503,7 @@ window_copy_clear_selection(struct window_pane *wp) window_copy_update_cursor(wp, px, data->cy); } -int +static int window_copy_in_set(struct window_pane *wp, u_int px, u_int py, const char *set) { struct window_copy_mode_data *data = wp->modedata; @@ -1514,7 +1520,7 @@ window_copy_in_set(struct window_pane *wp, u_int px, u_int py, const char *set) return (strchr(set, *ud->data) != NULL); } -u_int +static u_int window_copy_find_length(struct window_pane *wp, u_int py) { struct window_copy_mode_data *data = wp->modedata; @@ -1540,7 +1546,7 @@ window_copy_find_length(struct window_pane *wp, u_int py) return (px); } -void +static void window_copy_cursor_start_of_line(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1562,7 +1568,7 @@ window_copy_cursor_start_of_line(struct window_pane *wp) window_copy_redraw_lines(wp, data->cy, 1); } -void +static void window_copy_cursor_back_to_indentation(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1585,7 +1591,7 @@ window_copy_cursor_back_to_indentation(struct window_pane *wp) window_copy_redraw_lines(wp, data->cy, 1); } -void +static void window_copy_cursor_end_of_line(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1616,7 +1622,7 @@ window_copy_cursor_end_of_line(struct window_pane *wp) window_copy_redraw_lines(wp, data->cy, 1); } -void +static void window_copy_other_end(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1654,7 +1660,7 @@ window_copy_other_end(struct window_pane *wp) window_copy_redraw_screen(wp); } -void +static void window_copy_cursor_left(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1671,7 +1677,7 @@ window_copy_cursor_left(struct window_pane *wp) } } -void +static void window_copy_cursor_right(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1695,7 +1701,7 @@ window_copy_cursor_right(struct window_pane *wp) } } -void +static void window_copy_cursor_up(struct window_pane *wp, int scroll_only) { struct window_copy_mode_data *data = wp->modedata; @@ -1745,7 +1751,7 @@ window_copy_cursor_up(struct window_pane *wp, int scroll_only) window_copy_cursor_start_of_line(wp); } -void +static void window_copy_cursor_down(struct window_pane *wp, int scroll_only) { struct window_copy_mode_data *data = wp->modedata; @@ -1787,7 +1793,7 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only) window_copy_cursor_start_of_line(wp); } -void +static void window_copy_cursor_jump(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1812,7 +1818,7 @@ window_copy_cursor_jump(struct window_pane *wp) } } -void +static void window_copy_cursor_jump_back(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -1841,7 +1847,7 @@ window_copy_cursor_jump_back(struct window_pane *wp) } } -void +static void window_copy_cursor_jump_to(struct window_pane *wp, int jump_again) { struct window_copy_mode_data *data = wp->modedata; @@ -1866,7 +1872,7 @@ window_copy_cursor_jump_to(struct window_pane *wp, int jump_again) } } -void +static void window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again) { struct window_copy_mode_data *data = wp->modedata; @@ -1898,7 +1904,7 @@ window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again) } } -void +static void window_copy_cursor_next_word(struct window_pane *wp, const char *separators) { struct window_copy_mode_data *data = wp->modedata; @@ -1940,7 +1946,7 @@ window_copy_cursor_next_word(struct window_pane *wp, const char *separators) window_copy_redraw_lines(wp, data->cy, 1); } -void +static void window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators) { @@ -1992,7 +1998,7 @@ window_copy_cursor_next_word_end(struct window_pane *wp, } /* Move to the previous place where a word begins. */ -void +static void window_copy_cursor_previous_word(struct window_pane *wp, const char *separators) { @@ -2030,7 +2036,7 @@ out: window_copy_redraw_lines(wp, data->cy, 1); } -void +static void window_copy_scroll_up(struct window_pane *wp, u_int ny) { struct window_copy_mode_data *data = wp->modedata; @@ -2060,7 +2066,7 @@ window_copy_scroll_up(struct window_pane *wp, u_int ny) screen_write_stop(&ctx); } -void +static void window_copy_scroll_down(struct window_pane *wp, u_int ny) { struct window_copy_mode_data *data = wp->modedata; @@ -2100,7 +2106,7 @@ window_copy_scroll_position(struct window_pane *wp) return (data->oy); } -void +static void window_copy_rectangle_toggle(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; @@ -2117,7 +2123,7 @@ window_copy_rectangle_toggle(struct window_pane *wp) window_copy_redraw_screen(wp); } -void +static void window_copy_move_mouse(struct mouse_event *m) { struct window_pane *wp; @@ -2157,7 +2163,7 @@ window_copy_start_drag(struct client *c, struct mouse_event *m) window_copy_redraw_screen(wp); } -void +static void window_copy_drag_update(__unused struct client *c, struct mouse_event *m) { struct window_pane *wp; diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index cc105de82f8..74b36a33f9a 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.168 2016/10/11 07:23:34 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.169 2016/10/11 13:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -60,15 +60,23 @@ static u_int next_window_pane_id; static u_int next_window_id; static u_int next_active_point; +static struct window_pane *window_pane_create(struct window *, u_int, u_int, + u_int); +static void window_pane_destroy(struct window_pane *); + static void window_pane_set_watermark(struct window_pane *, size_t); static void window_pane_read_callback(struct bufferevent *, void *); static void window_pane_error_callback(struct bufferevent *, short, void *); +static int winlink_next_index(struct winlinks *, int); + static struct window_pane *window_pane_choose_best(struct window_pane **, u_int); RB_GENERATE(windows, window, entry, window_cmp); +RB_GENERATE(winlinks, winlink, entry, winlink_cmp); +RB_GENERATE(window_pane_tree, window_pane, tree_entry, window_pane_cmp); int window_cmp(struct window *w1, struct window *w2) @@ -76,16 +84,12 @@ window_cmp(struct window *w1, struct window *w2) return (w1->id - w2->id); } -RB_GENERATE(winlinks, winlink, entry, winlink_cmp); - int winlink_cmp(struct winlink *wl1, struct winlink *wl2) { return (wl1->idx - wl2->idx); } -RB_GENERATE(window_pane_tree, window_pane, tree_entry, window_pane_cmp); - int window_pane_cmp(struct window_pane *wp1, struct window_pane *wp2) { @@ -129,7 +133,7 @@ winlink_find_by_window_id(struct winlinks *wwl, u_int id) return (NULL); } -int +static int winlink_next_index(struct winlinks *wwl, int idx) { int i; @@ -731,7 +735,7 @@ window_pane_find_by_id(u_int id) return (RB_FIND(window_pane_tree, &all_window_panes, &wp)); } -struct window_pane * +static struct window_pane * window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) { struct window_pane *wp; @@ -782,7 +786,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) return (wp); } -void +static void window_pane_destroy(struct window_pane *wp) { window_pane_reset_mode(wp); |