Add static in window-*.c and move some internal functions out of tmux.h.

This commit is contained in:
nicm 2016-10-11 13:21:59 +00:00
parent 85d7afaefc
commit e45401846f
13 changed files with 233 additions and 237 deletions

View File

@ -35,6 +35,7 @@ struct args_entry {
RB_ENTRY(args_entry) 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 struct args_entry *args_find(struct args *, u_char);
static int args_cmp(struct args_entry *, struct args_entry *); 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); 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. */ /* Find a flag in the arguments tree. */
static struct args_entry * static struct args_entry *
args_find(struct args *args, u_char ch) 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. */ /* Set argument value in the arguments tree. */
void static void
args_set(struct args *args, u_char ch, const char *value) args_set(struct args *args, u_char ch, const char *value)
{ {
struct args_entry *entry; struct args_entry *entry;

View File

@ -26,6 +26,7 @@
#include "tmux.h" #include "tmux.h"
static enum cmd_retval cmdq_continue_one(struct cmd_q *); static enum cmd_retval cmdq_continue_one(struct cmd_q *);
static void cmdq_flush(struct cmd_q *);
/* Create new command queue. */ /* Create new command queue. */
struct cmd_q * struct cmd_q *
@ -319,7 +320,7 @@ out:
} }
/* Flush command queue. */ /* Flush command queue. */
void static void
cmdq_flush(struct cmd_q *cmdq) cmdq_flush(struct cmd_q *cmdq)
{ {
struct cmd_q_item *item, *item1; struct cmd_q_item *item, *item1;

5
grid.c
View File

@ -43,6 +43,8 @@ const struct grid_cell_entry grid_default_entry = {
0, { .data = { 0, 8, 8, ' ' } } 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 *, static void grid_reflow_copy(struct grid_line *, u_int, struct grid_line *,
u_int, u_int); u_int, u_int);
static void grid_reflow_join(struct grid *, u_int *, struct grid_line *, 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 *, static void grid_reflow_split(struct grid *, u_int *, struct grid_line *,
u_int, u_int); u_int, u_int);
static void grid_reflow_move(struct grid *, u_int *, struct grid_line *); 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_fg(const struct grid_cell *, int *);
static size_t grid_string_cells_bg(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 *, 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. */ /* Expand line to fit to cell. */
void static void
grid_expand_line(struct grid *gd, u_int py, u_int sx) grid_expand_line(struct grid *gd, u_int py, u_int sx)
{ {
struct grid_line *gl; struct grid_line *gl;

View File

@ -25,8 +25,10 @@
#include "tmux.h" #include "tmux.h"
static void name_time_callback(int, short, void *); static void name_time_callback(int, short, void *);
static int name_time_expired(struct window *, struct timeval *); static int name_time_expired(struct window *, struct timeval *);
static char *format_window_name(struct window *);
static void static void
name_time_callback(__unused int fd, __unused short events, void *arg) name_time_callback(__unused int fd, __unused short events, void *arg)
@ -115,7 +117,7 @@ default_window_name(struct window *w)
return (s); return (s);
} }
char * static char *
format_window_name(struct window *w) format_window_name(struct window *w)
{ {
struct format_tree *ft; struct format_tree *ft;

View File

@ -27,6 +27,8 @@
static void screen_resize_x(struct screen *, u_int); static void screen_resize_x(struct screen *, u_int);
static void screen_resize_y(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. */ /* Create a new screen. */
void void
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) 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. */ /* Reflow wrapped lines. */
void static void
screen_reflow(struct screen *s, u_int new_x) screen_reflow(struct screen *s, u_int new_x)
{ {
struct grid *old = s->grid; struct grid *old = s->grid;

View File

@ -30,6 +30,7 @@
static struct session *server_next_session(struct session *); static struct session *server_next_session(struct session *);
static void server_callback_identify(int, short, void *); static void server_callback_identify(int, short, void *);
static void server_destroy_session_group(struct session *);
void void
server_fill_environ(struct session *s, struct environ *env) 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); server_redraw_window(w);
} }
void static void
server_destroy_session_group(struct session *s) server_destroy_session_group(struct session *s)
{ {
struct session_group *sg; struct session_group *sg;

View File

@ -38,6 +38,10 @@ static void session_lock_timer(int, short, void *);
static struct winlink *session_next_alert(struct winlink *); static struct winlink *session_next_alert(struct winlink *);
static struct winlink *session_previous_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); RB_GENERATE(sessions, session, entry, session_cmp);
int 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. */ /* Remove a session from its group and destroy the group if empty. */
void static void
session_group_remove(struct session *s) session_group_remove(struct session *s)
{ {
struct session_group *sg; struct session_group *sg;
@ -599,7 +603,7 @@ session_group_remove(struct session *s)
} }
/* Count number of sessions in session group. */ /* Count number of sessions in session group. */
u_int static u_int
session_group_count(struct session_group *sg) session_group_count(struct session_group *sg)
{ {
struct session *s; 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 * winlinks then recreating them, then updating the current window, last window
* stack and alerts. * stack and alerts.
*/ */
void static void
session_group_synchronize1(struct session *target, struct session *s) session_group_synchronize1(struct session *target, struct session *s)
{ {
struct winlinks old_windows, *ww; struct winlinks old_windows, *ww;

7
tmux.c
View File

@ -47,6 +47,9 @@ const char *socket_path;
static __dead void usage(void); static __dead void usage(void);
static char *make_label(const char *); static char *make_label(const char *);
static const char *getshell(void);
static int checkshell(const char *);
static __dead void static __dead void
usage(void) usage(void)
{ {
@ -57,7 +60,7 @@ usage(void)
exit(1); exit(1);
} }
const char * static const char *
getshell(void) getshell(void)
{ {
struct passwd *pw; struct passwd *pw;
@ -74,7 +77,7 @@ getshell(void)
return (_PATH_BSHELL); return (_PATH_BSHELL);
} }
int static int
checkshell(const char *shell) checkshell(const char *shell)
{ {
if (shell == NULL || *shell == '\0' || *shell != '/') if (shell == NULL || *shell == '\0' || *shell != '/')

21
tmux.h
View File

@ -1520,8 +1520,6 @@ extern struct options *global_w_options;
extern struct environ *global_environ; extern struct environ *global_environ;
extern struct timeval start_time; extern struct timeval start_time;
extern const char *socket_path; extern const char *socket_path;
const char *getshell(void);
int checkshell(const char *);
int areshell(const char *); int areshell(const char *);
void setblocking(int, int); void setblocking(int, int);
const char *find_home(void); const char *find_home(void);
@ -1681,14 +1679,11 @@ void environ_log(struct environ *, const char *);
/* tty.c */ /* tty.c */
void tty_create_log(void); void tty_create_log(void);
void tty_init_termios(int, struct termios *, struct bufferevent *);
void tty_raw(struct tty *, const char *); void tty_raw(struct tty *, const char *);
void tty_attributes(struct tty *, const struct grid_cell *, void tty_attributes(struct tty *, const struct grid_cell *,
const struct window_pane *); const struct window_pane *);
void tty_reset(struct tty *); 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_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_cursor(struct tty *, u_int, u_int);
void tty_putcode(struct tty *, enum tty_code_code); void tty_putcode(struct tty *, enum tty_code_code);
void tty_putcode1(struct tty *, enum tty_code_code, int); 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_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *); void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int, struct screen *); 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, void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
u_int); u_int);
void tty_draw_line(struct tty *, const struct window_pane *, struct screen *, 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 *); key_code tty_keys_next(struct tty *);
/* arguments.c */ /* arguments.c */
struct args *args_create(int, ...);
struct args *args_parse(const char *, int, char **); struct args *args_parse(const char *, int, char **);
void args_free(struct args *); void args_free(struct args *);
char *args_print(struct args *); char *args_print(struct args *);
int args_has(struct args *, u_char); int args_has(struct args *, u_char);
void args_set(struct args *, u_char, const char *);
const char *args_get(struct args *, u_char); const char *args_get(struct args *, u_char);
long long args_strtonum(struct args *, u_char, long long, long long, long long args_strtonum(struct args *, u_char, long long, long long,
char **); char **);
@ -1832,7 +1824,6 @@ void cmdq_run(struct cmd_q *, struct cmd_list *,
void cmdq_append(struct cmd_q *, struct cmd_list *, void cmdq_append(struct cmd_q *, struct cmd_list *,
struct mouse_event *); struct mouse_event *);
int cmdq_continue(struct cmd_q *); int cmdq_continue(struct cmd_q *);
void cmdq_flush(struct cmd_q *);
/* cmd-string.c */ /* cmd-string.c */
int cmd_string_parse(const char *, struct cmd_list **, const char *, 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 **); struct winlink *, struct session *, int, int, int, char **);
void server_unlink_window(struct session *, struct winlink *); void server_unlink_window(struct session *, struct winlink *);
void server_destroy_pane(struct window_pane *, int); void server_destroy_pane(struct window_pane *, int);
void server_destroy_session_group(struct session *);
void server_destroy_session(struct session *); void server_destroy_session(struct session *);
void server_check_unattached(void); void server_check_unattached(void);
void server_set_identify(struct client *); 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(struct grid *);
void grid_scroll_history_region(struct grid *, u_int, u_int); void grid_scroll_history_region(struct grid *, u_int, u_int);
void grid_clear_history(struct grid *); 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); 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_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 *); 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 *); u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
void screen_clear_selection(struct screen *); void screen_clear_selection(struct screen *);
int screen_check_selection(struct screen *, u_int, u_int); int screen_check_selection(struct screen *, u_int, u_int);
void screen_reflow(struct screen *, u_int);
/* window.c */ /* window.c */
extern struct windows windows; 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_index(struct winlinks *, int);
struct winlink *winlink_find_by_window(struct winlinks *, struct window *); struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
struct winlink *winlink_find_by_window_id(struct winlinks *, u_int); struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
int winlink_next_index(struct winlinks *, int);
u_int winlink_count(struct winlinks *); u_int winlink_count(struct winlinks *);
struct winlink *winlink_add(struct winlinks *, int); struct winlink *winlink_add(struct winlinks *, int);
void winlink_set_window(struct winlink *, struct window *); 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 *); 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_str(const char *);
struct window_pane *window_pane_find_by_id(u_int); 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 **, int window_pane_spawn(struct window_pane *, int, char **,
const char *, const char *, const char *, struct environ *, const char *, const char *, const char *, struct environ *,
struct termios *, char **); struct termios *, char **);
@ -2223,7 +2208,6 @@ void window_choose_ready(struct window_pane *,
u_int, void (*)(struct window_choose_data *)); u_int, void (*)(struct window_choose_data *));
struct window_choose_data *window_choose_data_create (int, struct window_choose_data *window_choose_data_create (int,
struct client *, struct session *); struct client *, struct session *);
void window_choose_data_free(struct window_choose_data *);
void window_choose_data_run(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 window_choose_data *window_choose_add_window(struct window_pane *,
struct client *, struct session *, struct winlink *, 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 *, struct client *, struct session *, 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); void window_choose_set_current(struct window_pane *, u_int);
/* names.c */ /* names.c */
void check_window_name(struct window *); void check_window_name(struct window *);
char *default_window_name(struct window *); char *default_window_name(struct window *);
char *format_window_name(struct window *);
char *parse_window_name(const char *); char *parse_window_name(const char *);
/* signal.c */ /* signal.c */
@ -2295,11 +2277,8 @@ int session_set_current(struct session *, struct winlink *);
struct session_group *session_group_find(struct session *); struct session_group *session_group_find(struct session *);
u_int session_group_index(struct session_group *); u_int session_group_index(struct session_group *);
void session_group_add(struct session *, struct session *); 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_to(struct session *);
void session_group_synchronize_from(struct session *); void session_group_synchronize_from(struct session *);
void session_group_synchronize1(struct session *, struct session *);
void session_renumber_windows(struct session *); void session_renumber_windows(struct session *);
/* utf8.c */ /* utf8.c */

15
tty.c
View File

@ -33,6 +33,8 @@
static int tty_log_fd = -1; 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_read_callback(struct bufferevent *, void *);
static void tty_error_callback(struct bufferevent *, short, 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 void tty_set_italics(struct tty *);
static int tty_try_colour(struct tty *, int, const char *); 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_colours(struct tty *, const struct grid_cell *);
static void tty_check_fg(struct tty *, 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_fg(struct tty *, const struct grid_cell *);
static void tty_colours_bg(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_large_region(struct tty *, const struct tty_ctx *);
static int tty_fake_bce(const struct tty *, const struct window_pane *); static int tty_fake_bce(const struct tty *, const struct window_pane *);
static void tty_redraw_region(struct tty *, const struct tty_ctx *); 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) tty_init_termios(int fd, struct termios *orig_tio, struct bufferevent *bufev)
{ {
struct termios tio; struct termios tio;
@ -478,7 +485,7 @@ tty_set_title(struct tty *tty, const char *title)
tty_putcode(tty, TTYC_FSL); tty_putcode(tty, TTYC_FSL);
} }
void static void
tty_force_cursor_colour(struct tty *tty, const char *ccolour) tty_force_cursor_colour(struct tty *tty, const char *ccolour)
{ {
if (*ccolour == '\0') if (*ccolour == '\0')
@ -1182,7 +1189,7 @@ tty_reset(struct tty *tty)
} }
/* Set region inside pane. */ /* Set region inside pane. */
void static void
tty_region_pane(struct tty *tty, const struct tty_ctx *ctx, u_int rupper, tty_region_pane(struct tty *tty, const struct tty_ctx *ctx, u_int rupper,
u_int rlower) u_int rlower)
{ {
@ -1215,7 +1222,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower)
} }
/* Move cursor inside pane. */ /* 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_pane(struct tty *tty, const struct tty_ctx *ctx, u_int cx, u_int cy)
{ {
tty_cursor(tty, ctx->xoff + cx, ctx->yoff + cy); tty_cursor(tty, ctx->xoff + cx, ctx->yoff + cy);

View File

@ -24,27 +24,32 @@
#include "tmux.h" #include "tmux.h"
struct screen *window_choose_init(struct window_pane *); static struct screen *window_choose_init(struct window_pane *);
void window_choose_free(struct window_pane *); static void window_choose_free(struct window_pane *);
void window_choose_resize(struct window_pane *, u_int, u_int); static void window_choose_resize(struct window_pane *, u_int, u_int);
void window_choose_key(struct window_pane *, struct client *, static void window_choose_key(struct window_pane *, struct client *,
struct session *, key_code, struct mouse_event *); struct session *, key_code, struct mouse_event *);
void window_choose_default_callback(struct window_choose_data *); static void window_choose_default_callback(struct window_choose_data *);
struct window_choose_mode_item *window_choose_get_item(struct window_pane *, static struct window_choose_mode_item *window_choose_get_item(
key_code, struct mouse_event *); struct window_pane *, key_code, struct mouse_event *);
void window_choose_fire_callback(struct window_pane *, static void window_choose_fire_callback(struct window_pane *,
struct window_choose_data *); struct window_choose_data *);
void window_choose_redraw_screen(struct window_pane *); static void window_choose_redraw_screen(struct window_pane *);
void window_choose_write_line(struct window_pane *, static void window_choose_write_line(struct window_pane *,
struct screen_write_ctx *, u_int); struct screen_write_ctx *, u_int);
void window_choose_scroll_up(struct window_pane *); static void window_choose_scroll_up(struct window_pane *);
void window_choose_scroll_down(struct window_pane *); static void window_choose_scroll_down(struct window_pane *);
void window_choose_collapse(struct window_pane *, struct session *, u_int); static void window_choose_collapse(struct window_pane *, struct session *,
void window_choose_expand(struct window_pane *, struct session *, u_int); 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 { enum window_choose_input_type {
WINDOW_CHOOSE_NORMAL = -1, WINDOW_CHOOSE_NORMAL = -1,
@ -86,12 +91,14 @@ struct window_choose_mode_data {
void (*callbackfn)(struct window_choose_data *); void (*callbackfn)(struct window_choose_data *);
}; };
void window_choose_free1(struct window_choose_mode_data *); static void window_choose_free1(struct window_choose_mode_data *);
int window_choose_key_index(struct window_choose_mode_data *, u_int); static int window_choose_key_index(struct window_choose_mode_data *,
int window_choose_index_key(struct window_choose_mode_data *, key_code); u_int);
void window_choose_prompt_input(enum window_choose_input_type, static int window_choose_index_key(struct window_choose_mode_data *,
const char *, struct window_pane *, key_code); key_code);
void window_choose_reset_top(struct window_pane *, u_int); 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 void
window_choose_add(struct window_pane *wp, struct window_choose_data *wcd) 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)); window_choose_reset_top(wp, screen_size_y(s));
} }
void static void
window_choose_reset_top(struct window_pane *wp, u_int sy) window_choose_reset_top(struct window_pane *wp, u_int sy)
{ {
struct window_choose_mode_data *data = wp->modedata; 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); window_choose_collapse_all(wp);
} }
struct screen * static struct screen *
window_choose_init(struct window_pane *wp) window_choose_init(struct window_pane *wp)
{ {
struct window_choose_mode_data *data; struct window_choose_mode_data *data;
@ -218,7 +225,7 @@ window_choose_data_create(int type, struct client *c, struct session *s)
return (wcd); return (wcd);
} }
void static void
window_choose_data_free(struct window_choose_data *wcd) window_choose_data_free(struct window_choose_data *wcd)
{ {
server_client_unref(wcd->start_client); server_client_unref(wcd->start_client);
@ -260,7 +267,7 @@ window_choose_data_run(struct window_choose_data *cdata)
cmd_list_free(cmdlist); cmd_list_free(cmdlist);
} }
void static void
window_choose_default_callback(struct window_choose_data *wcd) window_choose_default_callback(struct window_choose_data *wcd)
{ {
if (wcd == NULL) if (wcd == NULL)
@ -271,14 +278,14 @@ window_choose_default_callback(struct window_choose_data *wcd)
window_choose_data_run(wcd); window_choose_data_run(wcd);
} }
void static void
window_choose_free(struct window_pane *wp) window_choose_free(struct window_pane *wp)
{ {
if (wp->modedata != NULL) if (wp->modedata != NULL)
window_choose_free1(wp->modedata); window_choose_free1(wp->modedata);
} }
void static void
window_choose_free1(struct window_choose_mode_data *data) window_choose_free1(struct window_choose_mode_data *data)
{ {
struct window_choose_mode_item *item; struct window_choose_mode_item *item;
@ -301,7 +308,7 @@ window_choose_free1(struct window_choose_mode_data *data)
free(data); free(data);
} }
void static void
window_choose_resize(struct window_pane *wp, u_int sx, u_int sy) window_choose_resize(struct window_pane *wp, u_int sx, u_int sy)
{ {
struct window_choose_mode_data *data = wp->modedata; 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); window_choose_redraw_screen(wp);
} }
void static void
window_choose_fire_callback(struct window_pane *wp, window_choose_fire_callback(struct window_pane *wp,
struct window_choose_data *wcd) struct window_choose_data *wcd)
{ {
@ -326,7 +333,7 @@ window_choose_fire_callback(struct window_pane *wp,
window_choose_free1(data); window_choose_free1(data);
} }
void static void
window_choose_prompt_input(enum window_choose_input_type input_type, window_choose_prompt_input(enum window_choose_input_type input_type,
const char *prompt, struct window_pane *wp, key_code key) 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); window_choose_redraw_screen(wp);
} }
void static void
window_choose_collapse(struct window_pane *wp, struct session *s, u_int pos) window_choose_collapse(struct window_pane *wp, struct session *s, u_int pos)
{ {
struct window_choose_mode_data *data = wp->modedata; 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) window_choose_collapse_all(struct window_pane *wp)
{ {
struct window_choose_mode_data *data = wp->modedata; 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)); 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) window_choose_expand(struct window_pane *wp, struct session *s, u_int pos)
{ {
struct window_choose_mode_data *data = wp->modedata; 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, window_choose_get_item(struct window_pane *wp, key_code key,
struct mouse_event *m) struct mouse_event *m)
{ {
@ -537,7 +544,7 @@ window_choose_get_item(struct window_pane *wp, key_code key,
return (&data->list[idx]); return (&data->list[idx]);
} }
void static void
window_choose_key(struct window_pane *wp, __unused struct client *c, window_choose_key(struct window_pane *wp, __unused struct client *c,
__unused struct session *sess, key_code key, struct mouse_event *m) __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, window_choose_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
u_int py) 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) window_choose_key_index(struct window_choose_mode_data *data, u_int idx)
{ {
static const char keys[] = "0123456789" static const char keys[] = "0123456789"
@ -846,7 +853,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx)
return (-1); return (-1);
} }
int static int
window_choose_index_key(struct window_choose_mode_data *data, key_code key) window_choose_index_key(struct window_choose_mode_data *data, key_code key)
{ {
static const char keys[] = "0123456789" static const char keys[] = "0123456789"
@ -867,7 +874,7 @@ window_choose_index_key(struct window_choose_mode_data *data, key_code key)
return (-1); return (-1);
} }
void static void
window_choose_redraw_screen(struct window_pane *wp) window_choose_redraw_screen(struct window_pane *wp)
{ {
struct window_choose_mode_data *data = wp->modedata; struct window_choose_mode_data *data = wp->modedata;
@ -881,7 +888,7 @@ window_choose_redraw_screen(struct window_pane *wp)
screen_write_stop(&ctx); screen_write_stop(&ctx);
} }
void static void
window_choose_scroll_up(struct window_pane *wp) window_choose_scroll_up(struct window_pane *wp)
{ {
struct window_choose_mode_data *data = wp->modedata; struct window_choose_mode_data *data = wp->modedata;
@ -900,7 +907,7 @@ window_choose_scroll_up(struct window_pane *wp)
screen_write_stop(&ctx); screen_write_stop(&ctx);
} }
void static void
window_choose_scroll_down(struct window_pane *wp) window_choose_scroll_down(struct window_pane *wp)
{ {
struct window_choose_mode_data *data = wp->modedata; struct window_choose_mode_data *data = wp->modedata;

View File

@ -24,76 +24,82 @@
#include "tmux.h" #include "tmux.h"
const char *window_copy_key_table(struct window_pane *); static const char *window_copy_key_table(struct window_pane *);
void window_copy_command(struct window_pane *, struct client *, static void window_copy_command(struct window_pane *, struct client *,
struct session *, struct args *, struct mouse_event *); struct session *, struct args *, struct mouse_event *);
struct screen *window_copy_init(struct window_pane *); static struct screen *window_copy_init(struct window_pane *);
void window_copy_free(struct window_pane *); static void window_copy_free(struct window_pane *);
void window_copy_pagedown(struct window_pane *, int); static void window_copy_pagedown(struct window_pane *, int);
void window_copy_next_paragraph(struct window_pane *); static void window_copy_next_paragraph(struct window_pane *);
void window_copy_previous_paragraph(struct window_pane *); static void window_copy_previous_paragraph(struct window_pane *);
void window_copy_resize(struct window_pane *, u_int, u_int); static void window_copy_resize(struct window_pane *, u_int, u_int);
void window_copy_redraw_selection(struct window_pane *, u_int); static void window_copy_redraw_selection(struct window_pane *, u_int);
void window_copy_redraw_lines(struct window_pane *, u_int, u_int); static void window_copy_redraw_lines(struct window_pane *, u_int, u_int);
void window_copy_redraw_screen(struct window_pane *); static void window_copy_redraw_screen(struct window_pane *);
void window_copy_write_line(struct window_pane *, struct screen_write_ctx *, static void window_copy_write_line(struct window_pane *,
u_int); struct screen_write_ctx *, u_int);
void window_copy_write_lines(struct window_pane *, static void window_copy_write_lines(struct window_pane *,
struct screen_write_ctx *, u_int, u_int); struct screen_write_ctx *, u_int, u_int);
void window_copy_scroll_to(struct window_pane *, u_int, u_int); static 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 *, static int window_copy_search_compare(struct grid *, u_int, u_int,
u_int, int); struct grid *, u_int, int);
int window_copy_search_lr(struct grid *, struct grid *, u_int *, u_int, static int window_copy_search_lr(struct grid *, struct grid *, u_int *,
u_int, u_int, int); u_int, u_int, u_int, int);
int window_copy_search_rl(struct grid *, struct grid *, u_int *, u_int, static int window_copy_search_rl(struct grid *, struct grid *, u_int *,
u_int, u_int, int); u_int, u_int, u_int, int);
void window_copy_move_left(struct screen *, u_int *, u_int *); static void window_copy_move_left(struct screen *, u_int *, u_int *);
void window_copy_move_right(struct screen *, u_int *, u_int *); static void window_copy_move_right(struct screen *, u_int *, u_int *);
int window_copy_is_lowercase(const char *); static int window_copy_is_lowercase(const char *);
void window_copy_search_jump(struct window_pane *, struct grid *, static void window_copy_search_jump(struct window_pane *, struct grid *,
struct grid *, u_int, u_int, u_int, int, int, int); struct grid *, u_int, u_int, u_int, int, int, int);
void window_copy_search(struct window_pane *, const char *, int, int); static void window_copy_search(struct window_pane *, const char *, int,
void window_copy_search_up(struct window_pane *, const char *, int); int);
void window_copy_search_down(struct window_pane *, const char *, int); static void window_copy_search_up(struct window_pane *, const char *, int);
void window_copy_goto_line(struct window_pane *, const char *); static void window_copy_search_down(struct window_pane *, const char *,
void window_copy_update_cursor(struct window_pane *, u_int, u_int); int);
void window_copy_start_selection(struct window_pane *); static void window_copy_goto_line(struct window_pane *, const char *);
int window_copy_update_selection(struct window_pane *, int); static void window_copy_update_cursor(struct window_pane *, u_int, u_int);
void *window_copy_get_selection(struct window_pane *, size_t *); static void window_copy_start_selection(struct window_pane *);
void window_copy_copy_buffer(struct window_pane *, const char *, void *, static int window_copy_update_selection(struct window_pane *, int);
size_t); static void *window_copy_get_selection(struct window_pane *, size_t *);
void window_copy_copy_pipe(struct window_pane *, struct session *, static void window_copy_copy_buffer(struct window_pane *, const char *,
const char *, const char *); void *, size_t);
void window_copy_copy_selection(struct window_pane *, const char *); static void window_copy_copy_pipe(struct window_pane *, struct session *,
void window_copy_append_selection(struct window_pane *, const char *); const char *, const char *);
void window_copy_clear_selection(struct window_pane *); static void window_copy_copy_selection(struct window_pane *, const char *);
void window_copy_copy_line(struct window_pane *, char **, size_t *, u_int, static void window_copy_append_selection(struct window_pane *,
u_int, u_int); const char *);
int window_copy_in_set(struct window_pane *, u_int, u_int, const char *); static void window_copy_clear_selection(struct window_pane *);
u_int window_copy_find_length(struct window_pane *, u_int); static void window_copy_copy_line(struct window_pane *, char **, size_t *,
void window_copy_cursor_start_of_line(struct window_pane *); u_int, u_int, u_int);
void window_copy_cursor_back_to_indentation(struct window_pane *); static int window_copy_in_set(struct window_pane *, u_int, u_int,
void window_copy_cursor_end_of_line(struct window_pane *); const char *);
void window_copy_other_end(struct window_pane *); static u_int window_copy_find_length(struct window_pane *, u_int);
void window_copy_cursor_left(struct window_pane *); static void window_copy_cursor_start_of_line(struct window_pane *);
void window_copy_cursor_right(struct window_pane *); static void window_copy_cursor_back_to_indentation(struct window_pane *);
void window_copy_cursor_up(struct window_pane *, int); static void window_copy_cursor_end_of_line(struct window_pane *);
void window_copy_cursor_down(struct window_pane *, int); static void window_copy_other_end(struct window_pane *);
void window_copy_cursor_jump(struct window_pane *); static void window_copy_cursor_left(struct window_pane *);
void window_copy_cursor_jump_back(struct window_pane *); static void window_copy_cursor_right(struct window_pane *);
void window_copy_cursor_jump_to(struct window_pane *, int); static void window_copy_cursor_up(struct window_pane *, int);
void window_copy_cursor_jump_to_back(struct window_pane *, int); static void window_copy_cursor_down(struct window_pane *, int);
void window_copy_cursor_next_word(struct window_pane *, const char *); static void window_copy_cursor_jump(struct window_pane *);
void window_copy_cursor_next_word_end(struct window_pane *, const char *); static void window_copy_cursor_jump_back(struct window_pane *);
void window_copy_cursor_previous_word(struct window_pane *, const char *); static void window_copy_cursor_jump_to(struct window_pane *, int);
void window_copy_scroll_up(struct window_pane *, u_int); static void window_copy_cursor_jump_to_back(struct window_pane *, int);
void window_copy_scroll_down(struct window_pane *, u_int); static void window_copy_cursor_next_word(struct window_pane *,
void window_copy_rectangle_toggle(struct window_pane *); const char *);
void window_copy_move_mouse(struct mouse_event *); static void window_copy_cursor_next_word_end(struct window_pane *,
void window_copy_drag_update(struct client *, struct mouse_event *); const char *);
void window_copy_drag_release(struct client *, struct mouse_event *); 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 = { const struct window_mode window_copy_mode = {
.init = window_copy_init, .init = window_copy_init,
@ -156,7 +162,7 @@ struct window_copy_mode_data {
char jumpchar; char jumpchar;
}; };
struct screen * static struct screen *
window_copy_init(struct window_pane *wp) window_copy_init(struct window_pane *wp)
{ {
struct window_copy_mode_data *data; 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); screen_size_y(&wp->base), UINT_MAX);
} }
void static void
window_copy_free(struct window_pane *wp) window_copy_free(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
void static void
window_copy_pagedown(struct window_pane *wp, int half_page) window_copy_pagedown(struct window_pane *wp, int half_page)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
void static void
window_copy_previous_paragraph(struct window_pane *wp) window_copy_previous_paragraph(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_scroll_to(wp, 0, oy);
} }
void static void
window_copy_next_paragraph(struct window_pane *wp) window_copy_next_paragraph(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_scroll_to(wp, ox, oy);
} }
void static void
window_copy_resize(struct window_pane *wp, u_int sx, u_int sy) window_copy_resize(struct window_pane *wp, u_int sx, u_int sy)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
const char * static const char *
window_copy_key_table(struct window_pane *wp) window_copy_key_table(struct window_pane *wp)
{ {
if (options_get_number(wp->window->options, "mode-keys") == MODEKEY_VI) 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"); return ("copy-mode");
} }
void static void
window_copy_command(struct window_pane *wp, struct client *c, struct session *s, window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
struct args *args, struct mouse_event *m) 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; wp->modeprefix = 1;
} }
void static void
window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py) window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
int static int
window_copy_search_compare(struct grid *gd, u_int px, u_int py, window_copy_search_compare(struct grid *gd, u_int px, u_int py,
struct grid *sgd, u_int spx, int cis) 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); return (memcmp(ud->data, sud->data, ud->size) == 0);
} }
int static int
window_copy_search_lr(struct grid *gd, window_copy_search_lr(struct grid *gd,
struct grid *sgd, u_int *ppx, u_int py, u_int first, u_int last, int cis) 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); return (0);
} }
int static int
window_copy_search_rl(struct grid *gd, window_copy_search_rl(struct grid *gd,
struct grid *sgd, u_int *ppx, u_int py, u_int first, u_int last, int cis) 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); return (0);
} }
void static void
window_copy_move_left(struct screen *s, u_int *fx, u_int *fy) window_copy_move_left(struct screen *s, u_int *fx, u_int *fy)
{ {
if (*fx == 0) { /* left */ if (*fx == 0) { /* left */
@ -912,7 +918,7 @@ window_copy_move_left(struct screen *s, u_int *fx, u_int *fy)
*fx = *fx - 1; *fx = *fx - 1;
} }
void static void
window_copy_move_right(struct screen *s, u_int *fx, u_int *fy) window_copy_move_right(struct screen *s, u_int *fx, u_int *fy)
{ {
if (*fx == screen_size_x(s) - 1) { /* right */ 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; *fx = *fx + 1;
} }
int static int
window_copy_is_lowercase(const char *ptr) window_copy_is_lowercase(const char *ptr)
{ {
while (*ptr != '\0') { 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 * up, down otherwise. If wrap then go to begin/end of grid and try again if
* not found. * not found.
*/ */
void static void
window_copy_search_jump(struct window_pane *wp, struct grid *gd, 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, struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap,
int direction) 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 * down. If moveflag is 0 then look for string at the current cursor position
* as well. * as well.
*/ */
void static void
window_copy_search(struct window_pane *wp, const char *searchstr, int direction, window_copy_search(struct window_pane *wp, const char *searchstr, int direction,
int moveflag) int moveflag)
{ {
@ -1024,21 +1030,21 @@ window_copy_search(struct window_pane *wp, const char *searchstr, int direction,
screen_free(&ss); screen_free(&ss);
} }
void static void
window_copy_search_up(struct window_pane *wp, const char *searchstr, window_copy_search_up(struct window_pane *wp, const char *searchstr,
int moveflag) int moveflag)
{ {
window_copy_search(wp, searchstr, 0, moveflag); window_copy_search(wp, searchstr, 0, moveflag);
} }
void static void
window_copy_search_down(struct window_pane *wp, const char *searchstr, window_copy_search_down(struct window_pane *wp, const char *searchstr,
int moveflag) int moveflag)
{ {
window_copy_search(wp, searchstr, 1, moveflag); window_copy_search(wp, searchstr, 1, moveflag);
} }
void static void
window_copy_goto_line(struct window_pane *wp, const char *linestr) window_copy_goto_line(struct window_pane *wp, const char *linestr)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
void static void
window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
u_int py) 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, window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx,
u_int py, u_int ny) 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); window_copy_write_line(wp, ctx, py);
} }
void static void
window_copy_redraw_selection(struct window_pane *wp, u_int old_y) window_copy_redraw_selection(struct window_pane *wp, u_int old_y)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); 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) window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); screen_write_stop(&ctx);
} }
void static void
window_copy_redraw_screen(struct window_pane *wp) window_copy_redraw_screen(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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)); 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) window_copy_update_cursor(struct window_pane *wp, u_int cx, u_int cy)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_start_selection(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_update_selection(wp, 1);
} }
int static int
window_copy_update_selection(struct window_pane *wp, int may_redraw) window_copy_update_selection(struct window_pane *wp, int may_redraw)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); return (1);
} }
void * static void *
window_copy_get_selection(struct window_pane *wp, size_t *len) window_copy_get_selection(struct window_pane *wp, size_t *len)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); return (buf);
} }
void static void
window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf, window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf,
size_t len) size_t len)
{ {
@ -1349,7 +1355,7 @@ window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf,
free(buf); free(buf);
} }
void static void
window_copy_copy_pipe(struct window_pane *wp, struct session *sess, window_copy_copy_pipe(struct window_pane *wp, struct session *sess,
const char *bufname, const char *arg) 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); window_copy_copy_buffer(wp, bufname, buf, len);
} }
void static void
window_copy_copy_selection(struct window_pane *wp, const char *bufname) window_copy_copy_selection(struct window_pane *wp, const char *bufname)
{ {
void *buf; 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); window_copy_copy_buffer(wp, bufname, buf, len);
} }
void static void
window_copy_append_selection(struct window_pane *wp, const char *bufname) window_copy_append_selection(struct window_pane *wp, const char *bufname)
{ {
char *buf; char *buf;
@ -1423,7 +1429,7 @@ window_copy_append_selection(struct window_pane *wp, const char *bufname)
free(buf); free(buf);
} }
void static void
window_copy_copy_line(struct window_pane *wp, char **buf, size_t *off, u_int sy, window_copy_copy_line(struct window_pane *wp, char **buf, size_t *off, u_int sy,
u_int sx, u_int ex) 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) window_copy_clear_selection(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); 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) 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; 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); return (strchr(set, *ud->data) != NULL);
} }
u_int static u_int
window_copy_find_length(struct window_pane *wp, u_int py) window_copy_find_length(struct window_pane *wp, u_int py)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); return (px);
} }
void static void
window_copy_cursor_start_of_line(struct window_pane *wp) window_copy_cursor_start_of_line(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_lines(wp, data->cy, 1);
} }
void static void
window_copy_cursor_back_to_indentation(struct window_pane *wp) window_copy_cursor_back_to_indentation(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_lines(wp, data->cy, 1);
} }
void static void
window_copy_cursor_end_of_line(struct window_pane *wp) window_copy_cursor_end_of_line(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_lines(wp, data->cy, 1);
} }
void static void
window_copy_other_end(struct window_pane *wp) window_copy_other_end(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
void static void
window_copy_cursor_left(struct window_pane *wp) window_copy_cursor_left(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_right(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_up(struct window_pane *wp, int scroll_only)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_cursor_start_of_line(wp);
} }
void static void
window_copy_cursor_down(struct window_pane *wp, int scroll_only) window_copy_cursor_down(struct window_pane *wp, int scroll_only)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_cursor_start_of_line(wp);
} }
void static void
window_copy_cursor_jump(struct window_pane *wp) window_copy_cursor_jump(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_jump_back(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_jump_to(struct window_pane *wp, int jump_again)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again)
{ {
struct window_copy_mode_data *data = wp->modedata; 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) window_copy_cursor_next_word(struct window_pane *wp, const char *separators)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_lines(wp, data->cy, 1);
} }
void static void
window_copy_cursor_next_word_end(struct window_pane *wp, window_copy_cursor_next_word_end(struct window_pane *wp,
const char *separators) 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. */ /* Move to the previous place where a word begins. */
void static void
window_copy_cursor_previous_word(struct window_pane *wp, window_copy_cursor_previous_word(struct window_pane *wp,
const char *separators) const char *separators)
{ {
@ -2030,7 +2036,7 @@ out:
window_copy_redraw_lines(wp, data->cy, 1); window_copy_redraw_lines(wp, data->cy, 1);
} }
void static void
window_copy_scroll_up(struct window_pane *wp, u_int ny) window_copy_scroll_up(struct window_pane *wp, u_int ny)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); screen_write_stop(&ctx);
} }
void static void
window_copy_scroll_down(struct window_pane *wp, u_int ny) window_copy_scroll_down(struct window_pane *wp, u_int ny)
{ {
struct window_copy_mode_data *data = wp->modedata; struct window_copy_mode_data *data = wp->modedata;
@ -2100,7 +2106,7 @@ window_copy_scroll_position(struct window_pane *wp)
return (data->oy); return (data->oy);
} }
void static void
window_copy_rectangle_toggle(struct window_pane *wp) window_copy_rectangle_toggle(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; 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); window_copy_redraw_screen(wp);
} }
void static void
window_copy_move_mouse(struct mouse_event *m) window_copy_move_mouse(struct mouse_event *m)
{ {
struct window_pane *wp; struct window_pane *wp;
@ -2157,7 +2163,7 @@ window_copy_start_drag(struct client *c, struct mouse_event *m)
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
} }
void static void
window_copy_drag_update(__unused struct client *c, struct mouse_event *m) window_copy_drag_update(__unused struct client *c, struct mouse_event *m)
{ {
struct window_pane *wp; struct window_pane *wp;

View File

@ -60,15 +60,23 @@ static u_int next_window_pane_id;
static u_int next_window_id; static u_int next_window_id;
static u_int next_active_point; 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_set_watermark(struct window_pane *, size_t);
static void window_pane_read_callback(struct bufferevent *, void *); static void window_pane_read_callback(struct bufferevent *, void *);
static void window_pane_error_callback(struct bufferevent *, short, 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 **, static struct window_pane *window_pane_choose_best(struct window_pane **,
u_int); u_int);
RB_GENERATE(windows, window, entry, window_cmp); 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 int
window_cmp(struct window *w1, struct window *w2) 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); return (w1->id - w2->id);
} }
RB_GENERATE(winlinks, winlink, entry, winlink_cmp);
int int
winlink_cmp(struct winlink *wl1, struct winlink *wl2) winlink_cmp(struct winlink *wl1, struct winlink *wl2)
{ {
return (wl1->idx - wl2->idx); return (wl1->idx - wl2->idx);
} }
RB_GENERATE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
int int
window_pane_cmp(struct window_pane *wp1, struct window_pane *wp2) 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); return (NULL);
} }
int static int
winlink_next_index(struct winlinks *wwl, int idx) winlink_next_index(struct winlinks *wwl, int idx)
{ {
int i; int i;
@ -731,7 +735,7 @@ window_pane_find_by_id(u_int id)
return (RB_FIND(window_pane_tree, &all_window_panes, &wp)); 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) window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
{ {
struct window_pane *wp; 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); return (wp);
} }
void static void
window_pane_destroy(struct window_pane *wp) window_pane_destroy(struct window_pane *wp)
{ {
window_pane_reset_mode(wp); window_pane_reset_mode(wp);