Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last

time now I've configured emacs to make them displayed in really annoying
colours...
This commit is contained in:
Nicholas Marriott 2009-12-03 22:50:09 +00:00
parent 6c9862662f
commit 15a64b805e
66 changed files with 418 additions and 416 deletions

View File

@ -143,7 +143,7 @@ client_send_environ(void)
struct msg_environ_data data; struct msg_environ_data data;
char **var; char **var;
for (var = environ; *var != NULL; var++) { for (var = environ; *var != NULL; var++) {
if (strlcpy(data.var, *var, sizeof data.var) >= sizeof data.var) if (strlcpy(data.var, *var, sizeof data.var) >= sizeof data.var)
continue; continue;
client_write_server(MSG_ENVIRON, &data, sizeof data); client_write_server(MSG_ENVIRON, &data, sizeof data);
@ -153,7 +153,7 @@ client_send_environ(void)
void void
client_write_server(enum msgtype type, void *buf, size_t len) client_write_server(enum msgtype type, void *buf, size_t len)
{ {
imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len); imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len);
} }
void void
@ -179,7 +179,7 @@ client_main(void)
/* Note: event_init() has already been called. */ /* Note: event_init() has already been called. */
/* Set up signals. */ /* Set up signals. */
memset(&sigact, 0, sizeof sigact); memset(&sigact, 0, sizeof sigact);
sigemptyset(&sigact.sa_mask); sigemptyset(&sigact.sa_mask);
sigact.sa_flags = SA_RESTART; sigact.sa_flags = SA_RESTART;

View File

@ -134,13 +134,13 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style)
for (ptr = tim; *ptr != '\0'; ptr++) { for (ptr = tim; *ptr != '\0'; ptr++) {
if (*ptr >= '0' && *ptr <= '9') if (*ptr >= '0' && *ptr <= '9')
idx = *ptr - '0'; idx = *ptr - '0';
else if (*ptr == ':') else if (*ptr == ':')
idx = 10; idx = 10;
else if (*ptr == 'A') else if (*ptr == 'A')
idx = 11; idx = 11;
else if (*ptr == 'P') else if (*ptr == 'P')
idx = 12; idx = 12;
else if (*ptr == 'M') else if (*ptr == 'M')
idx = 13; idx = 13;
else { else {
x += 6; x += 6;

View File

@ -29,7 +29,7 @@ int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_attach_session_entry = { const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach", "attach-session", "attach",
"[-d] " CMD_TARGET_SESSION_USAGE, "[-d] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d", CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d",
cmd_target_init, cmd_target_init,
cmd_target_parse, cmd_target_parse,
cmd_attach_session_exec, cmd_attach_session_exec,

View File

@ -64,18 +64,18 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (wl->window->active == NULL) if (wl->window->active == NULL)
wl->window->active = TAILQ_NEXT(wp, entry); wl->window->active = TAILQ_NEXT(wp, entry);
} }
layout_close_pane(wp); layout_close_pane(wp);
w = wp->window = window_create1(s->sx, s->sy); w = wp->window = window_create1(s->sx, s->sy);
TAILQ_INSERT_HEAD(&w->panes, wp, entry); TAILQ_INSERT_HEAD(&w->panes, wp, entry);
w->active = wp; w->active = wp;
w->name = default_window_name(w); w->name = default_window_name(w);
layout_init(w); layout_init(w);
base_idx = options_get_number(&s->options, "base-index"); base_idx = options_get_number(&s->options, "base-index");
wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */ wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
if (!cmd_check_flag(data->chflags, 'd')) if (!cmd_check_flag(data->chflags, 'd'))
session_select(s, wl->idx); session_select(s, wl->idx);
server_redraw_session(s); server_redraw_session(s);
server_status_session_group(s); server_status_session_group(s);

View File

@ -119,7 +119,7 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
window_choose_ready(wl->window->active, window_choose_ready(wl->window->active,
cur, cmd_choose_window_callback, cmd_choose_window_free, cdata); cur, cmd_choose_window_callback, cmd_choose_window_free, cdata);
return (0); return (0);
} }
void void

View File

@ -225,9 +225,9 @@ cmd_target_print(struct cmd *self, char *buf, size_t len)
off += cmd_print_flags(buf, len, off, data->chflags); off += cmd_print_flags(buf, len, off, data->chflags);
if (off < len && data->target != NULL) if (off < len && data->target != NULL)
off += cmd_prarg(buf + off, len - off, " -t ", data->target); off += cmd_prarg(buf + off, len - off, " -t ", data->target);
if (off < len && data->arg != NULL) if (off < len && data->arg != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg); off += cmd_prarg(buf + off, len - off, " ", data->arg);
if (off < len && data->arg2 != NULL) if (off < len && data->arg2 != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg2); off += cmd_prarg(buf + off, len - off, " ", data->arg2);
return (off); return (off);
} }
@ -317,9 +317,9 @@ cmd_srcdst_print(struct cmd *self, char *buf, size_t len)
off += xsnprintf(buf + off, len - off, " -s %s", data->src); off += xsnprintf(buf + off, len - off, " -s %s", data->src);
if (off < len && data->dst != NULL) if (off < len && data->dst != NULL)
off += xsnprintf(buf + off, len - off, " -t %s", data->dst); off += xsnprintf(buf + off, len - off, " -t %s", data->dst);
if (off < len && data->arg != NULL) if (off < len && data->arg != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg); off += cmd_prarg(buf + off, len - off, " ", data->arg);
if (off < len && data->arg2 != NULL) if (off < len && data->arg2 != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg2); off += cmd_prarg(buf + off, len - off, " ", data->arg2);
return (off); return (off);
} }
@ -415,9 +415,9 @@ cmd_buffer_print(struct cmd *self, char *buf, size_t len)
off += xsnprintf(buf + off, len - off, " -b %d", data->buffer); off += xsnprintf(buf + off, len - off, " -b %d", data->buffer);
if (off < len && data->target != NULL) if (off < len && data->target != NULL)
off += cmd_prarg(buf + off, len - off, " -t ", data->target); off += cmd_prarg(buf + off, len - off, " -t ", data->target);
if (off < len && data->arg != NULL) if (off < len && data->arg != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg); off += cmd_prarg(buf + off, len - off, " ", data->arg);
if (off < len && data->arg2 != NULL) if (off < len && data->arg2 != NULL)
off += cmd_prarg(buf + off, len - off, " ", data->arg2); off += cmd_prarg(buf + off, len - off, " ", data->arg2);
return (off); return (off);
} }

View File

@ -45,7 +45,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{ {
struct cmd_target_data *data = self->data; struct cmd_target_data *data = self->data;
struct session *s; struct session *s;
struct client *c; struct client *c;
u_int i; u_int i;
if ((s = cmd_find_session(ctx, data->target)) == NULL) if ((s = cmd_find_session(ctx, data->target)) == NULL)

View File

@ -75,7 +75,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
if (used >= sizeof tmp) if (used >= sizeof tmp)
continue; continue;
if (!(bd->key & KEYC_PREFIX)) { if (!(bd->key & KEYC_PREFIX)) {
used = strlcat(tmp, "(no prefix) ", sizeof tmp); used = strlcat(tmp, "(no prefix) ", sizeof tmp);
if (used >= sizeof tmp) if (used >= sizeof tmp)
continue; continue;

View File

@ -23,7 +23,7 @@
#include "tmux.h" #include "tmux.h"
/* /*
* List panes on given window.. * List panes on given window.
*/ */
int cmd_list_panes_exec(struct cmd *, struct cmd_ctx *); int cmd_list_panes_exec(struct cmd *, struct cmd_ctx *);

View File

@ -267,13 +267,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
* Set the client to the new session. If a command client exists, it is * Set the client to the new session. If a command client exists, it is
* taking this session and needs to get MSG_READY and stay around. * taking this session and needs to get MSG_READY and stay around.
*/ */
if (!detached) { if (!detached) {
if (ctx->cmdclient != NULL) { if (ctx->cmdclient != NULL) {
server_write_client(ctx->cmdclient, MSG_READY, NULL, 0); server_write_client(ctx->cmdclient, MSG_READY, NULL, 0);
ctx->cmdclient->session = s; ctx->cmdclient->session = s;
server_redraw_client(ctx->cmdclient); server_redraw_client(ctx->cmdclient);
} else { } else {
ctx->curclient->session = s; ctx->curclient->session = s;
server_redraw_client(ctx->curclient); server_redraw_client(ctx->curclient);
} }
} }

View File

@ -78,7 +78,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
paste_free_index(&s->buffers, data->buffer); paste_free_index(&s->buffers, data->buffer);
} }
return (0); return (0);
} }
/* Add bytes to a buffer but change every '\n' to '\r'. */ /* Add bytes to a buffer but change every '\n' to '\r'. */

View File

@ -72,7 +72,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
wp = TAILQ_FIRST(&w->panes); wp = TAILQ_FIRST(&w->panes);
TAILQ_REMOVE(&w->panes, wp, entry); TAILQ_REMOVE(&w->panes, wp, entry);
layout_free(w); layout_free(w);
window_destroy_panes(w); window_destroy_panes(w);
TAILQ_INSERT_HEAD(&w->panes, wp, entry); TAILQ_INSERT_HEAD(&w->panes, wp, entry);
window_pane_resize(wp, w->sx, w->sy); window_pane_resize(wp, w->sx, w->sy);
if (window_pane_spawn( if (window_pane_spawn(

View File

@ -52,7 +52,7 @@ cmd_select_layout_init(struct cmd *self, int key)
break; break;
case ('2' | KEYC_ESCAPE): case ('2' | KEYC_ESCAPE):
data->arg = xstrdup("even-vertical"); data->arg = xstrdup("even-vertical");
break; break;
case ('3' | KEYC_ESCAPE): case ('3' | KEYC_ESCAPE):
data->arg = xstrdup("main-horizontal"); data->arg = xstrdup("main-horizontal");
break; break;

View File

@ -33,7 +33,7 @@ size_t cmd_send_keys_print(struct cmd *, char *, size_t);
struct cmd_send_keys_data { struct cmd_send_keys_data {
char *target; char *target;
u_int nkeys; u_int nkeys;
int *keys; int *keys;
}; };

View File

@ -99,7 +99,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
} }
ctx->print(ctx, "%s", ""); ctx->print(ctx, "%s", "");
ctx->print(ctx, "Sessions: [%zu/%zu]", ctx->print(ctx, "Sessions: [%zu/%zu]",
sizeof (struct grid_cell), sizeof (struct grid_utf8)); sizeof (struct grid_cell), sizeof (struct grid_utf8));
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i); s = ARRAY_ITEM(&sessions, i);
@ -148,7 +148,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
} }
ctx->print(ctx, "%s", ""); ctx->print(ctx, "%s", "");
ctx->print(ctx, "Terminals:"); ctx->print(ctx, "Terminals:");
SLIST_FOREACH(term, &tty_terms, entry) { SLIST_FOREACH(term, &tty_terms, entry) {
ctx->print(ctx, "%s [references=%u, flags=0x%x]:", ctx->print(ctx, "%s [references=%u, flags=0x%x]:",
term->name, term->references, term->flags); term->name, term->references, term->flags);
@ -180,7 +180,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
} }
ctx->print(ctx, "%s", ""); ctx->print(ctx, "%s", "");
ctx->print(ctx, "Jobs:"); ctx->print(ctx, "Jobs:");
SLIST_FOREACH(job, &all_jobs, lentry) { SLIST_FOREACH(job, &all_jobs, lentry) {
ctx->print(ctx, "%s [fd=%d, pid=%d, status=%d, flags=0x%x]", ctx->print(ctx, "%s [fd=%d, pid=%d, status=%d, flags=0x%x]",
job->cmd, job->fd, job->pid, job->status, job->flags); job->cmd, job->fd, job->pid, job->status, job->flags);

View File

@ -34,17 +34,17 @@ const char *cmd_set_option_print(
void cmd_set_option_string(struct cmd_ctx *, void cmd_set_option_string(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *, int); struct options *, const struct set_option_entry *, char *, int);
void cmd_set_option_number(struct cmd_ctx *, void cmd_set_option_number(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
void cmd_set_option_keys(struct cmd_ctx *, void cmd_set_option_keys(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
void cmd_set_option_colour(struct cmd_ctx *, void cmd_set_option_colour(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
void cmd_set_option_attributes(struct cmd_ctx *, void cmd_set_option_attributes(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
void cmd_set_option_flag(struct cmd_ctx *, void cmd_set_option_flag(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
void cmd_set_option_choice(struct cmd_ctx *, void cmd_set_option_choice(struct cmd_ctx *,
struct options *, const struct set_option_entry *, char *); struct options *, const struct set_option_entry *, char *);
const struct cmd_entry cmd_set_option_entry = { const struct cmd_entry cmd_set_option_entry = {
"set-option", "set", "set-option", "set",

View File

@ -121,7 +121,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
case EOF: case EOF:
case ' ': case ' ':
case '\t': case '\t':
if (have_arg) { if (have_arg) {
buf = xrealloc(buf, 1, len + 1); buf = xrealloc(buf, 1, len + 1);
buf[len] = '\0'; buf[len] = '\0';

4
cmd.c
View File

@ -534,7 +534,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
sfound = s; sfound = s;
} }
} }
return (sfound); return (sfound);
} }
/* /*
@ -830,7 +830,7 @@ no_colon:
no_session: no_session:
if (ambiguous) if (ambiguous)
ctx->error(ctx, "multiple sessions: %s", arg); ctx->error(ctx, "multiple sessions: %s", arg);
else else
ctx->error(ctx, "session not found: %s", arg); ctx->error(ctx, "session not found: %s", arg);
if (sessptr != NULL) if (sessptr != NULL)

View File

@ -149,7 +149,7 @@ grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
ny2 = rlower + 1 - py - ny; ny2 = rlower + 1 - py - ny;
grid_move_lines(gd, rlower + 1 - ny2, py, ny2); grid_move_lines(gd, rlower + 1 - ny2, py, ny2);
grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2); grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
} }
/* Delete lines. */ /* Delete lines. */
@ -165,7 +165,7 @@ grid_view_delete_lines(struct grid *gd, u_int py, u_int ny)
sy = grid_view_y(gd, gd->sy); sy = grid_view_y(gd, gd->sy);
grid_move_lines(gd, py, py + ny, sy - py - ny); grid_move_lines(gd, py, py + ny, sy - py - ny);
grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny)); grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny));
} }
/* Delete lines inside scroll region. */ /* Delete lines inside scroll region. */
@ -182,7 +182,7 @@ grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
ny2 = rlower + 1 - py - ny; ny2 = rlower + 1 - py - ny;
grid_move_lines(gd, py, py + ny, ny2); grid_move_lines(gd, py, py + ny, ny2);
grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2); grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
} }
/* Insert characters. */ /* Insert characters. */

18
grid.c
View File

@ -170,7 +170,7 @@ grid_collect_history(struct grid *gd)
{ {
u_int yy; u_int yy;
GRID_DEBUG(gd, ""); GRID_DEBUG(gd, "");
if (gd->hsize < gd->hlimit) if (gd->hsize < gd->hlimit)
return; return;
@ -192,7 +192,7 @@ grid_scroll_history(struct grid *gd)
{ {
u_int yy; u_int yy;
GRID_DEBUG(gd, ""); GRID_DEBUG(gd, "");
yy = gd->hsize + gd->sy; yy = gd->hsize + gd->sy;
gd->linedata = xrealloc(gd->linedata, yy + 1, sizeof *gd->linedata); gd->linedata = xrealloc(gd->linedata, yy + 1, sizeof *gd->linedata);
@ -208,7 +208,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower)
struct grid_line *gl_history, *gl_upper, *gl_lower; struct grid_line *gl_history, *gl_upper, *gl_lower;
u_int yy; u_int yy;
GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower); GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower);
/* Create a space for a new line. */ /* Create a space for a new line. */
yy = gd->hsize + gd->sy; yy = gd->hsize + gd->sy;
@ -354,7 +354,7 @@ grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny)
{ {
u_int xx, yy; u_int xx, yy;
GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny); GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny);
if (nx == 0 || ny == 0) if (nx == 0 || ny == 0)
return; return;
@ -395,7 +395,7 @@ grid_clear_lines(struct grid *gd, u_int py, u_int ny)
struct grid_line *gl; struct grid_line *gl;
u_int yy; u_int yy;
GRID_DEBUG(gd, "py=%u, ny=%u", py, ny); GRID_DEBUG(gd, "py=%u, ny=%u", py, ny);
if (ny == 0) if (ny == 0)
return; return;
@ -421,7 +421,7 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny)
{ {
u_int yy; u_int yy;
GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny); GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny);
if (ny == 0 || py == dy) if (ny == 0 || py == dy)
return; return;
@ -460,7 +460,7 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx)
struct grid_line *gl; struct grid_line *gl;
u_int xx; u_int xx;
GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx); GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx);
if (nx == 0 || px == dx) if (nx == 0 || px == dx)
return; return;
@ -499,8 +499,8 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx)
char * char *
grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx) grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
{ {
const struct grid_cell *gc; const struct grid_cell *gc;
const struct grid_utf8 *gu; const struct grid_utf8 *gu;
char *buf; char *buf;
size_t len, off, size; size_t len, off, size;
u_int xx; u_int xx;

View File

@ -230,7 +230,7 @@ input_init(struct window_pane *wp)
ictx->string_len = 0; ictx->string_len = 0;
ictx->string_buf = NULL; ictx->string_buf = NULL;
memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell); memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
memcpy(&ictx->saved_cell, &grid_default_cell, sizeof ictx->saved_cell); memcpy(&ictx->saved_cell, &grid_default_cell, sizeof ictx->saved_cell);
ictx->saved_cx = 0; ictx->saved_cx = 0;
@ -297,7 +297,7 @@ input_state_first(u_char ch, struct input_ctx *ictx)
} }
#if 0 #if 0
if (INPUT_C1CONTROL(ch)) { if (INPUT_C1CONTROL(ch)) {
ch -= 0x40; ch -= 0x40;
if (ch == '[') if (ch == '[')
input_state(ictx, input_state_sequence_first); input_state(ictx, input_state_sequence_first);
@ -1284,7 +1284,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
* Turn history back on (so resize can use it) and then * Turn history back on (so resize can use it) and then
* resize back to the current size. * resize back to the current size.
*/ */
wp->base.grid->flags |= GRID_HISTORY; wp->base.grid->flags |= GRID_HISTORY;
if (sy > wp->saved_grid->sy) if (sy > wp->saved_grid->sy)
screen_resize(s, sx, sy); screen_resize(s, sx, sy);
@ -1372,7 +1372,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
if (ARRAY_LENGTH(&ictx->args) == 0) { if (ARRAY_LENGTH(&ictx->args) == 0) {
attr = gc->attr; attr = gc->attr;
memcpy(gc, &grid_default_cell, sizeof *gc); memcpy(gc, &grid_default_cell, sizeof *gc);
gc->attr |= (attr & GRID_ATTR_CHARSET); gc->attr |= (attr & GRID_ATTR_CHARSET);
return; return;
} }

View File

@ -199,7 +199,7 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
va_end(ap); va_end(ap);
*msg = toupper((u_char) *msg); *msg = toupper((u_char) *msg);
status_message_set(ctx->curclient, "%s", msg); status_message_set(ctx->curclient, "%s", msg);
xfree(msg); xfree(msg);
} }
@ -232,7 +232,7 @@ key_bindings_info(struct cmd_ctx *ctx, const char *fmt, ...)
va_end(ap); va_end(ap);
*msg = toupper((u_char) *msg); *msg = toupper((u_char) *msg);
status_message_set(ctx->curclient, "%s", msg); status_message_set(ctx->curclient, "%s", msg);
xfree(msg); xfree(msg);
} }

View File

@ -295,7 +295,7 @@ layout_set_main_h(struct window *w)
continue; continue;
} }
/* Add in the columns. */ /* Add in the columns. */
layout_make_node(lcrow, LAYOUT_LEFTRIGHT); layout_make_node(lcrow, LAYOUT_LEFTRIGHT);
for (i = 0; i < columns; i++) { for (i = 0; i < columns; i++) {
/* Create and add a pane cell. */ /* Create and add a pane cell. */
@ -312,11 +312,11 @@ layout_set_main_h(struct window *w)
/* Adjust the row to fit the full width if necessary. */ /* Adjust the row to fit the full width if necessary. */
if (i == columns) if (i == columns)
i--; i--;
used = ((i + 1) * width) - 1; used = ((i + 1) * width) - 1;
if (w->sx <= used) if (w->sx <= used)
continue; continue;
lcchild = TAILQ_LAST(&lcrow->cells, layout_cells); lcchild = TAILQ_LAST(&lcrow->cells, layout_cells);
layout_resize_adjust(lcchild, LAYOUT_LEFTRIGHT, w->sx - used); layout_resize_adjust(lcchild, LAYOUT_LEFTRIGHT, w->sx - used);
} }
/* Adjust the last row height to fit if necessary. */ /* Adjust the last row height to fit if necessary. */
@ -422,10 +422,10 @@ layout_set_main_v(struct window *w)
if (i == rows) if (i == rows)
i--; i--;
used = ((i + 1) * height) - 1; used = ((i + 1) * height) - 1;
if (w->sy <= used) if (w->sy <= used)
continue; continue;
lcchild = TAILQ_LAST(&lccolumn->cells, layout_cells); lcchild = TAILQ_LAST(&lccolumn->cells, layout_cells);
layout_resize_adjust(lcchild, LAYOUT_TOPBOTTOM, w->sy - used); layout_resize_adjust(lcchild, LAYOUT_TOPBOTTOM, w->sy - used);
} }
/* Adjust the last column width to fit if necessary. */ /* Adjust the last column width to fit if necessary. */

View File

@ -554,7 +554,7 @@ layout_split_pane(struct window_pane *wp,
case LAYOUT_LEFTRIGHT: case LAYOUT_LEFTRIGHT:
if (size < 0) if (size < 0)
size2 = ((sx + 1) / 2) - 1; size2 = ((sx + 1) / 2) - 1;
else else
size2 = size; size2 = size;
if (size2 < PANE_MINIMUM) if (size2 < PANE_MINIMUM)
size2 = PANE_MINIMUM; size2 = PANE_MINIMUM;

2
log.c
View File

@ -183,7 +183,7 @@ log_vfatal(const char *msg, va_list ap)
log_vwrite(LOG_CRIT, fmt, ap); log_vwrite(LOG_CRIT, fmt, ap);
} else { } else {
if (asprintf(&fmt, "fatal: %s", msg) == -1) if (asprintf(&fmt, "fatal: %s", msg) == -1)
exit(1); exit(1);
log_vwrite(LOG_CRIT, fmt, ap); log_vwrite(LOG_CRIT, fmt, ap);
} }
free(fmt); free(fmt);

View File

@ -42,7 +42,7 @@
/* Edit keys command strings. */ /* Edit keys command strings. */
struct mode_key_cmdstr mode_key_cmdstr_edit[] = { struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
{ MODEKEYEDIT_BACKSPACE, "backspace" }, { MODEKEYEDIT_BACKSPACE, "backspace" },
{ MODEKEYEDIT_CANCEL, "cancel" }, { MODEKEYEDIT_CANCEL, "cancel" },
{ MODEKEYEDIT_COMPLETE, "complete" }, { MODEKEYEDIT_COMPLETE, "complete" },
{ MODEKEYEDIT_CURSORLEFT, "cursor-left" }, { MODEKEYEDIT_CURSORLEFT, "cursor-left" },
{ MODEKEYEDIT_CURSORRIGHT, "cursor-right" }, { MODEKEYEDIT_CURSORRIGHT, "cursor-right" },

View File

@ -728,7 +728,7 @@ screen_write_clearendofline(struct screen_write_ctx *ctx)
if (s->cx <= sx - 1) if (s->cx <= sx - 1)
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1);
tty_write(tty_cmd_clearendofline, &ttyctx); tty_write(tty_cmd_clearendofline, &ttyctx);
} }
/* Clear to start of line from cursor. */ /* Clear to start of line from cursor. */
@ -863,7 +863,7 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
s->cy++; s->cy++;
ttyctx.num = wrapped; ttyctx.num = wrapped;
tty_write(tty_cmd_linefeed, &ttyctx); tty_write(tty_cmd_linefeed, &ttyctx);
} }
/* Carriage return (cursor to start of line). */ /* Carriage return (cursor to start of line). */

View File

@ -191,7 +191,7 @@ screen_resize_y(struct screen *s, u_int sy)
grid_view_delete_lines(gd, 0, available); grid_view_delete_lines(gd, 0, available);
} }
s->cy -= needed; s->cy -= needed;
} }
/* Resize line arrays. */ /* Resize line arrays. */
gd->linedata = xrealloc( gd->linedata = xrealloc(

View File

@ -36,7 +36,7 @@ void server_client_reset_state(struct client *);
int server_client_msg_dispatch(struct client *); int server_client_msg_dispatch(struct client *);
void server_client_msg_command(struct client *, struct msg_command_data *); void server_client_msg_command(struct client *, struct msg_command_data *);
void server_client_msg_identify( void server_client_msg_identify(
struct client *, struct msg_identify_data *, int); struct client *, struct msg_identify_data *, int);
void server_client_msg_shell(struct client *); void server_client_msg_shell(struct client *);
void printflike2 server_client_msg_error(struct cmd_ctx *, const char *, ...); void printflike2 server_client_msg_error(struct cmd_ctx *, const char *, ...);

View File

@ -121,7 +121,7 @@ server_window_check_bell(struct session *s, struct window *w)
tty_putcode(&c->tty, TTYC_BEL); tty_putcode(&c->tty, TTYC_BEL);
continue; continue;
} }
if (c->session->curw->window == w) { if (c->session->curw->window == w) {
status_message_set(c, "Bell in current window"); status_message_set(c, "Bell in current window");
continue; continue;
} }
@ -137,7 +137,7 @@ server_window_check_bell(struct session *s, struct window *w)
c = ARRAY_ITEM(&clients, i); c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s) if (c == NULL || c->session != s)
continue; continue;
if (c->session->curw->window != w) if (c->session->curw->window != w)
continue; continue;
if (!visual) { if (!visual) {
tty_putcode(&c->tty, TTYC_BEL); tty_putcode(&c->tty, TTYC_BEL);
@ -163,7 +163,7 @@ server_window_check_activity(struct session *s, struct window *w)
if (s->curw->window == w) if (s->curw->window == w)
return (0); return (0);
if (!options_get_number(&w->options, "monitor-activity")) if (!options_get_number(&w->options, "monitor-activity"))
return (0); return (0);
if (session_alert_has_window(s, w, WINDOW_ACTIVITY)) if (session_alert_has_window(s, w, WINDOW_ACTIVITY))
@ -172,7 +172,7 @@ server_window_check_activity(struct session *s, struct window *w)
if (s->flags & SESSION_UNATTACHED) if (s->flags & SESSION_UNATTACHED)
return (0); return (0);
if (options_get_number(&s->options, "visual-activity")) { if (options_get_number(&s->options, "visual-activity")) {
for (i = 0; i < ARRAY_LENGTH(&clients); i++) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i); c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s) if (c == NULL || c->session != s)
@ -208,12 +208,12 @@ server_window_check_content(
if ((found = window_pane_search(wp, ptr, NULL)) == NULL) if ((found = window_pane_search(wp, ptr, NULL)) == NULL)
return (0); return (0);
xfree(found); xfree(found);
session_alert_add(s, w, WINDOW_CONTENT); session_alert_add(s, w, WINDOW_CONTENT);
if (s->flags & SESSION_UNATTACHED) if (s->flags & SESSION_UNATTACHED)
return (0); return (0);
if (options_get_number(&s->options, "visual-content")) { if (options_get_number(&s->options, "visual-content")) {
for (i = 0; i < ARRAY_LENGTH(&clients); i++) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i); c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s) if (c == NULL || c->session != s)

View File

@ -554,7 +554,7 @@ server_lock_server(void)
void void
server_lock_sessions(void) server_lock_sessions(void)
{ {
struct session *s; struct session *s;
u_int i; u_int i;
int timeout; int timeout;
time_t t; time_t t;

View File

@ -37,9 +37,9 @@ char *status_job(struct client *, char **);
void status_job_callback(struct job *); void status_job_callback(struct job *);
size_t status_width(struct client *, struct winlink *, time_t); size_t status_width(struct client *, struct winlink *, time_t);
char *status_print( char *status_print(
struct client *, struct winlink *, time_t, struct grid_cell *); struct client *, struct winlink *, time_t, struct grid_cell *);
void status_replace1(struct client *, void status_replace1(struct client *,
struct winlink *, char **, char **, char *, size_t, int); struct winlink *, char **, char **, char *, size_t, int);
void status_message_callback(int, short, void *); void status_message_callback(int, short, void *);
void status_prompt_add_history(struct client *); void status_prompt_add_history(struct client *);
@ -163,7 +163,7 @@ status_redraw(struct client *c)
* Figure out how much space we have for the window list. If there * Figure out how much space we have for the window list. If there
* isn't enough space, just show a blank status line. * isn't enough space, just show a blank status line.
*/ */
needed = 0; needed = 0;
if (llen != 0) if (llen != 0)
needed += llen + 1; needed += llen + 1;
if (rlen != 0) if (rlen != 0)
@ -193,7 +193,7 @@ status_redraw(struct client *c)
/* And draw the window list into it. */ /* And draw the window list into it. */
screen_write_start(&ctx, NULL, &window_list); screen_write_start(&ctx, NULL, &window_list);
RB_FOREACH(wl, winlinks, &s->windows) { RB_FOREACH(wl, winlinks, &s->windows) {
screen_write_cnputs(&ctx, screen_write_cnputs(&ctx,
-1, &wl->status_cell, utf8flag, "%s", wl->status_text); -1, &wl->status_cell, utf8flag, "%s", wl->status_text);
screen_write_putc(&ctx, &stdgc, ' '); screen_write_putc(&ctx, &stdgc, ' ');
} }
@ -271,7 +271,7 @@ status_redraw(struct client *c)
} }
draw: draw:
/* Begin drawing. */ /* Begin drawing. */
screen_write_start(&ctx, NULL, &c->status); screen_write_start(&ctx, NULL, &c->status);
/* Draw the left string and arrow. */ /* Draw the left string and arrow. */
@ -320,7 +320,7 @@ draw:
/* Copy the window list. */ /* Copy the window list. */
screen_write_cursormove(&ctx, wloffset, 0); screen_write_cursormove(&ctx, wloffset, 0);
screen_write_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1); screen_write_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1);
screen_free(&window_list); screen_free(&window_list);
screen_write_stop(&ctx); screen_write_stop(&ctx);
@ -779,7 +779,7 @@ status_prompt_set(struct client *c, const char *msg,
void void
status_prompt_clear(struct client *c) status_prompt_clear(struct client *c)
{ {
if (c->prompt_string == NULL) if (c->prompt_string == NULL)
return; return;
if (c->prompt_freefn != NULL && c->prompt_data != NULL) if (c->prompt_freefn != NULL && c->prompt_data != NULL)
@ -857,8 +857,8 @@ status_prompt_redraw(struct client *c)
screen_write_nputs( screen_write_nputs(
&ctx, left, &gc, utf8flag, "%s", c->prompt_buffer + off); &ctx, left, &gc, utf8flag, "%s", c->prompt_buffer + off);
for (i = len + size; i < c->tty.sx; i++) for (i = len + size; i < c->tty.sx; i++)
screen_write_putc(&ctx, &gc, ' '); screen_write_putc(&ctx, &gc, ' ');
} }
screen_write_stop(&ctx); screen_write_stop(&ctx);
@ -949,12 +949,12 @@ status_prompt_key(struct client *c, int key)
size -= last - first; size -= last - first;
/* Insert the new word. */ /* Insert the new word. */
size += strlen(s); size += strlen(s);
off = first - c->prompt_buffer; off = first - c->prompt_buffer;
c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 1); c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 1);
first = c->prompt_buffer + off; first = c->prompt_buffer + off;
memmove(first + strlen(s), first, n); memmove(first + strlen(s), first, n);
memcpy(first, s, strlen(s)); memcpy(first, s, strlen(s));
c->prompt_index = (first - c->prompt_buffer) + strlen(s); c->prompt_index = (first - c->prompt_buffer) + strlen(s);
xfree(s); xfree(s);
@ -974,7 +974,7 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS; c->flags |= CLIENT_STATUS;
} }
break; break;
case MODEKEYEDIT_DELETE: case MODEKEYEDIT_DELETE:
if (c->prompt_index != size) { if (c->prompt_index != size) {
memmove(c->prompt_buffer + c->prompt_index, memmove(c->prompt_buffer + c->prompt_index,
c->prompt_buffer + c->prompt_index + 1, c->prompt_buffer + c->prompt_index + 1,
@ -1056,7 +1056,7 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS; c->flags |= CLIENT_STATUS;
} }
break; break;
case MODEKEYEDIT_ENTER: case MODEKEYEDIT_ENTER:
if (*c->prompt_buffer != '\0') if (*c->prompt_buffer != '\0')
status_prompt_add_history(c); status_prompt_add_history(c);
if (c->prompt_callbackfn(c->prompt_data, c->prompt_buffer) == 0) if (c->prompt_callbackfn(c->prompt_data, c->prompt_buffer) == 0)

10
tmux.c
View File

@ -219,7 +219,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
struct cmd_list *cmdlist; struct cmd_list *cmdlist;
struct cmd *cmd; struct cmd *cmd;
enum msgtype msg; enum msgtype msg;
struct passwd *pw; struct passwd *pw;
struct options *so, *wo; struct options *so, *wo;
@ -311,7 +311,7 @@ main(int argc, char **argv)
} }
environ_init(&global_environ); environ_init(&global_environ);
for (var = environ; *var != NULL; var++) for (var = environ; *var != NULL; var++)
environ_put(&global_environ, *var); environ_put(&global_environ, *var);
options_init(&global_s_options, NULL); options_init(&global_s_options, NULL);
@ -394,10 +394,10 @@ main(int argc, char **argv)
options_set_string(wo, "window-status-format", "#I:#W#F"); options_set_string(wo, "window-status-format", "#I:#W#F");
options_set_string(wo, "window-status-current-format", "#I:#W#F"); options_set_string(wo, "window-status-current-format", "#I:#W#F");
options_set_number(wo, "xterm-keys", 0); options_set_number(wo, "xterm-keys", 0);
options_set_number(wo, "remain-on-exit", 0); options_set_number(wo, "remain-on-exit", 0);
options_set_number(wo, "synchronize-panes", 0); options_set_number(wo, "synchronize-panes", 0);
if (flags & IDENTIFY_UTF8) { if (flags & IDENTIFY_UTF8) {
options_set_number(so, "status-utf8", 1); options_set_number(so, "status-utf8", 1);
options_set_number(wo, "utf8", 1); options_set_number(wo, "utf8", 1);
} else { } else {
@ -490,7 +490,7 @@ main(int argc, char **argv)
event_init(); event_init();
imsg_compose(main_ibuf, msg, PROTOCOL_VERSION, -1, -1, buf, len); imsg_compose(main_ibuf, msg, PROTOCOL_VERSION, -1, -1, buf, len);
main_set_signals(); main_set_signals();

126
tmux.h
View File

@ -340,9 +340,9 @@ enum tty_code_type {
struct tty_code { struct tty_code {
enum tty_code_type type; enum tty_code_type type;
union { union {
char *string; char *string;
int number; int number;
int flag; int flag;
} value; } value;
}; };
@ -404,15 +404,15 @@ struct msg_identify_data {
}; };
struct msg_lock_data { struct msg_lock_data {
char cmd[COMMAND_LENGTH]; char cmd[COMMAND_LENGTH];
}; };
struct msg_environ_data { struct msg_environ_data {
char var[ENVIRON_LENGTH]; char var[ENVIRON_LENGTH];
}; };
struct msg_shell_data { struct msg_shell_data {
char shell[MAXPATHLEN]; char shell[MAXPATHLEN];
}; };
/* Mode key commands. */ /* Mode key commands. */
@ -511,13 +511,13 @@ SPLAY_HEAD(mode_key_tree, mode_key_binding);
/* Command to string mapping. */ /* Command to string mapping. */
struct mode_key_cmdstr { struct mode_key_cmdstr {
enum mode_key_cmd cmd; enum mode_key_cmd cmd;
const char *name; const char *name;
}; };
/* Named mode key table description. */ /* Named mode key table description. */
struct mode_key_table { struct mode_key_table {
const char *name; const char *name;
struct mode_key_cmdstr *cmdstr; struct mode_key_cmdstr *cmdstr;
struct mode_key_tree *tree; struct mode_key_tree *tree;
const struct mode_key_entry *table; /* default entries */ const struct mode_key_entry *table; /* default entries */
@ -683,7 +683,7 @@ struct screen_sel {
struct screen { struct screen {
char *title; char *title;
struct grid *grid; /* grid data */ struct grid *grid; /* grid data */
u_int cx; /* cursor x */ u_int cx; /* cursor x */
u_int cy; /* cursor y */ u_int cy; /* cursor y */
@ -693,7 +693,7 @@ struct screen {
int mode; int mode;
bitstr_t *tabs; bitstr_t *tabs;
struct screen_sel sel; struct screen_sel sel;
}; };
@ -743,7 +743,7 @@ struct input_ctx {
struct utf8_data utf8data; struct utf8_data utf8data;
u_char intermediate; u_char intermediate;
void *(*state)(u_char, struct input_ctx *); void *(*state)(u_char, struct input_ctx *);
u_char private; u_char private;
ARRAY_DECL(, struct input_arg) args; ARRAY_DECL(, struct input_arg) args;
@ -762,7 +762,7 @@ struct window_mode {
void (*resize)(struct window_pane *, u_int, u_int); void (*resize)(struct window_pane *, u_int, u_int);
void (*key)(struct window_pane *, struct client *, int); void (*key)(struct window_pane *, struct client *, int);
void (*mouse)(struct window_pane *, void (*mouse)(struct window_pane *,
struct client *, struct mouse_event *); struct client *, struct mouse_event *);
void (*timer)(struct window_pane *); void (*timer)(struct window_pane *);
}; };
@ -800,8 +800,8 @@ struct window_pane {
struct screen base; struct screen base;
/* Saved in alternative screen mode. */ /* Saved in alternative screen mode. */
u_int saved_cx; u_int saved_cx;
u_int saved_cy; u_int saved_cy;
struct grid *saved_grid; struct grid *saved_grid;
struct grid_cell saved_cell; struct grid_cell saved_cell;
@ -949,7 +949,7 @@ ARRAY_DECL(sessions, struct session *);
/* TTY information. */ /* TTY information. */
struct tty_key { struct tty_key {
char ch; char ch;
int key; int key;
struct tty_key *left; struct tty_key *left;
struct tty_key *right; struct tty_key *right;
@ -975,8 +975,8 @@ SLIST_HEAD(tty_terms, tty_term);
struct tty { struct tty {
char *path; char *path;
u_int sx; u_int sx;
u_int sy; u_int sy;
u_int cx; u_int cx;
u_int cy; u_int cy;
@ -994,7 +994,7 @@ struct tty {
int log_fd; int log_fd;
struct termios tio; struct termios tio;
struct grid_cell cell; struct grid_cell cell;
@ -1006,7 +1006,7 @@ struct tty {
#define TTY_UTF8 0x8 #define TTY_UTF8 0x8
#define TTY_STARTED 0x10 #define TTY_STARTED 0x10
#define TTY_OPENED 0x20 #define TTY_OPENED 0x20
int flags; int flags;
int term_flags; int term_flags;
@ -1069,7 +1069,7 @@ struct client {
char *title; char *title;
char *cwd; char *cwd;
struct tty tty; struct tty tty;
struct event repeat_timer; struct event repeat_timer;
struct timeval status_timer; struct timeval status_timer;
@ -1146,7 +1146,7 @@ struct cmd_ctx {
struct cmd { struct cmd {
const struct cmd_entry *entry; const struct cmd_entry *entry;
void *data; void *data;
TAILQ_ENTRY(cmd) qentry; TAILQ_ENTRY(cmd) qentry;
}; };
@ -1172,7 +1172,7 @@ struct cmd_entry {
int (*parse)(struct cmd *, int, char **, char **); int (*parse)(struct cmd *, int, char **, char **);
int (*exec)(struct cmd *, struct cmd_ctx *); int (*exec)(struct cmd *, struct cmd_ctx *);
void (*free)(struct cmd *); void (*free)(struct cmd *);
size_t (*print)(struct cmd *, char *, size_t); size_t (*print)(struct cmd *, char *, size_t);
}; };
/* Generic command data. */ /* Generic command data. */
@ -1242,7 +1242,7 @@ extern char *cfg_file;
extern int debug_level; extern int debug_level;
extern int be_quiet; extern int be_quiet;
extern time_t start_time; extern time_t start_time;
extern char *socket_path; extern char *socket_path;
extern int login_shell; extern int login_shell;
void logfile(const char *); void logfile(const char *);
const char *getshell(void); const char *getshell(void);
@ -1278,13 +1278,13 @@ struct options_entry *options_find1(struct options *, const char *);
struct options_entry *options_find(struct options *, const char *); struct options_entry *options_find(struct options *, const char *);
void options_remove(struct options *, const char *); void options_remove(struct options *, const char *);
struct options_entry *printflike3 options_set_string( struct options_entry *printflike3 options_set_string(
struct options *, const char *, const char *, ...); struct options *, const char *, const char *, ...);
char *options_get_string(struct options *, const char *); char *options_get_string(struct options *, const char *);
struct options_entry *options_set_number( struct options_entry *options_set_number(
struct options *, const char *, long long); struct options *, const char *, long long);
long long options_get_number(struct options *, const char *); long long options_get_number(struct options *, const char *);
struct options_entry *options_set_data( struct options_entry *options_set_data(
struct options *, const char *, void *, void (*)(void *)); struct options *, const char *, void *, void (*)(void *));
void *options_get_data(struct options *, const char *); void *options_get_data(struct options *, const char *);
/* job.c */ /* job.c */
@ -1312,7 +1312,7 @@ struct environ_entry *environ_find(struct environ *, const char *);
void environ_set(struct environ *, const char *, const char *); void environ_set(struct environ *, const char *, const char *);
void environ_put(struct environ *, const char *); void environ_put(struct environ *, const char *);
void environ_unset(struct environ *, const char *); void environ_unset(struct environ *, const char *);
void environ_update(const char *, struct environ *, struct environ *); void environ_update(const char *, struct environ *, struct environ *);
/* tty.c */ /* tty.c */
void tty_raw(struct tty *, const char *); void tty_raw(struct tty *, const char *);
@ -1361,12 +1361,12 @@ void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
extern struct tty_terms tty_terms; extern struct tty_terms tty_terms;
extern struct tty_term_code_entry tty_term_codes[NTTYCODE]; extern struct tty_term_code_entry tty_term_codes[NTTYCODE];
struct tty_term *tty_term_find(char *, int, const char *, char **); struct tty_term *tty_term_find(char *, int, const char *, char **);
void tty_term_free(struct tty_term *); void tty_term_free(struct tty_term *);
int tty_term_has(struct tty_term *, enum tty_code_code); int tty_term_has(struct tty_term *, enum tty_code_code);
const char *tty_term_string(struct tty_term *, enum tty_code_code); const char *tty_term_string(struct tty_term *, enum tty_code_code);
const char *tty_term_string1(struct tty_term *, enum tty_code_code, int); const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
const char *tty_term_string2( const char *tty_term_string2(
struct tty_term *, enum tty_code_code, int, int); struct tty_term *, enum tty_code_code, int, int);
int tty_term_number(struct tty_term *, enum tty_code_code); int tty_term_number(struct tty_term *, enum tty_code_code);
int tty_term_flag(struct tty_term *, enum tty_code_code); int tty_term_flag(struct tty_term *, enum tty_code_code);
@ -1381,7 +1381,7 @@ void paste_free_stack(struct paste_stack *);
struct paste_buffer *paste_walk_stack(struct paste_stack *, uint *); struct paste_buffer *paste_walk_stack(struct paste_stack *, uint *);
struct paste_buffer *paste_get_top(struct paste_stack *); struct paste_buffer *paste_get_top(struct paste_stack *);
struct paste_buffer *paste_get_index(struct paste_stack *, u_int); struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
int paste_free_top(struct paste_stack *); int paste_free_top(struct paste_stack *);
int paste_free_index(struct paste_stack *, u_int); int paste_free_index(struct paste_stack *, u_int);
void paste_add(struct paste_stack *, char *, size_t, u_int); void paste_add(struct paste_stack *, char *, size_t, u_int);
int paste_replace(struct paste_stack *, u_int, char *, size_t); int paste_replace(struct paste_stack *, u_int, char *, size_t);
@ -1393,7 +1393,7 @@ void clock_draw(struct screen_write_ctx *, int, int);
/* cmd-set-option.c */ /* cmd-set-option.c */
extern const struct set_option_entry set_session_option_table[]; extern const struct set_option_entry set_session_option_table[];
extern const struct set_option_entry set_window_option_table[]; extern const struct set_option_entry set_window_option_table[];
const char *cmd_set_option_print( const char *cmd_set_option_print(
const struct set_option_entry *, struct options_entry *); const struct set_option_entry *, struct options_entry *);
/* cmd.c */ /* cmd.c */
@ -1508,7 +1508,7 @@ size_t cmd_list_print(struct cmd_list *, char *, size_t);
int cmd_string_parse(const char *, struct cmd_list **, char **); int cmd_string_parse(const char *, struct cmd_list **, char **);
/* cmd-generic.c */ /* cmd-generic.c */
size_t cmd_prarg(char *, size_t, const char *, char *); size_t cmd_prarg(char *, size_t, const char *, char *);
int cmd_check_flag(uint64_t, int); int cmd_check_flag(uint64_t, int);
void cmd_set_flag(uint64_t *, int); void cmd_set_flag(uint64_t *, int);
#define CMD_TARGET_PANE_USAGE "[-t target-pane]" #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
@ -1580,9 +1580,9 @@ void server_window_loop(void);
void server_fill_environ(struct session *, struct environ *); void server_fill_environ(struct session *, struct environ *);
void server_write_error(struct client *, const char *); void server_write_error(struct client *, const char *);
void server_write_client( void server_write_client(
struct client *, enum msgtype, const void *, size_t); struct client *, enum msgtype, const void *, size_t);
void server_write_session( void server_write_session(
struct session *, enum msgtype, const void *, size_t); struct session *, enum msgtype, const void *, size_t);
void server_redraw_client(struct client *); void server_redraw_client(struct client *);
void server_status_client(struct client *); void server_status_client(struct client *);
void server_redraw_session(struct session *); void server_redraw_session(struct session *);
@ -1609,12 +1609,12 @@ void server_update_event(struct client *);
/* status.c */ /* status.c */
int status_redraw(struct client *); int status_redraw(struct client *);
char *status_replace( char *status_replace(
struct client *, struct winlink *, const char *, time_t, int); struct client *, struct winlink *, const char *, time_t, int);
void printflike2 status_message_set(struct client *, const char *, ...); void printflike2 status_message_set(struct client *, const char *, ...);
void status_message_clear(struct client *); void status_message_clear(struct client *);
int status_message_redraw(struct client *); int status_message_redraw(struct client *);
void status_prompt_set(struct client *, const char *, void status_prompt_set(struct client *, const char *,
int (*)(void *, const char *), void (*)(void *), void *, int); int (*)(void *, const char *), void (*)(void *), void *, int);
void status_prompt_clear(struct client *); void status_prompt_clear(struct client *);
int status_prompt_redraw(struct client *); int status_prompt_redraw(struct client *);
void status_prompt_key(struct client *, int); void status_prompt_key(struct client *, int);
@ -1633,7 +1633,7 @@ void input_key(struct window_pane *, int);
void input_mouse(struct window_pane *, struct mouse_event *); void input_mouse(struct window_pane *, struct mouse_event *);
/* xterm-keys.c */ /* xterm-keys.c */
char *xterm_keys_lookup(int); char *xterm_keys_lookup(int);
int xterm_keys_find(const char *, size_t, size_t *, int *); int xterm_keys_find(const char *, size_t, size_t *, int *);
/* colour.c */ /* colour.c */
@ -1670,7 +1670,7 @@ void grid_move_lines(struct grid *, u_int, u_int, u_int);
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int); void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
char *grid_string_cells(struct grid *, u_int, u_int, u_int); char *grid_string_cells(struct grid *, u_int, u_int, u_int);
void grid_duplicate_lines( void grid_duplicate_lines(
struct grid *, u_int, struct grid *, u_int, u_int); struct grid *, u_int, struct grid *, u_int, u_int);
/* grid-utf8.c */ /* grid-utf8.c */
size_t grid_utf8_size(const struct grid_utf8 *); size_t grid_utf8_size(const struct grid_utf8 *);
@ -1683,11 +1683,11 @@ int grid_utf8_compare(const struct grid_utf8 *, const struct grid_utf8 *);
const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int); const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int); struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
void grid_view_set_cell( void grid_view_set_cell(
struct grid *, u_int, u_int, const struct grid_cell *); struct grid *, u_int, u_int, const struct grid_cell *);
const struct grid_utf8 *grid_view_peek_utf8(struct grid *, u_int, u_int); const struct grid_utf8 *grid_view_peek_utf8(struct grid *, u_int, u_int);
struct grid_utf8 *grid_view_get_utf8(struct grid *, u_int, u_int); struct grid_utf8 *grid_view_get_utf8(struct grid *, u_int, u_int);
void grid_view_set_utf8( void grid_view_set_utf8(
struct grid *, u_int, u_int, const struct grid_utf8 *); struct grid *, u_int, u_int, const struct grid_utf8 *);
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int); void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
void grid_view_scroll_region_up(struct grid *, u_int, u_int); void grid_view_scroll_region_up(struct grid *, u_int, u_int);
void grid_view_scroll_region_down(struct grid *, u_int, u_int); void grid_view_scroll_region_down(struct grid *, u_int, u_int);
@ -1701,22 +1701,22 @@ char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
/* screen-write.c */ /* screen-write.c */
void screen_write_start( void screen_write_start(
struct screen_write_ctx *, struct window_pane *, struct screen *); struct screen_write_ctx *, struct window_pane *, struct screen *);
void screen_write_stop(struct screen_write_ctx *); void screen_write_stop(struct screen_write_ctx *);
size_t printflike2 screen_write_cstrlen(int, const char *, ...); size_t printflike2 screen_write_cstrlen(int, const char *, ...);
void printflike5 screen_write_cnputs(struct screen_write_ctx *, void printflike5 screen_write_cnputs(struct screen_write_ctx *,
ssize_t, struct grid_cell *, int, const char *, ...); ssize_t, struct grid_cell *, int, const char *, ...);
size_t printflike2 screen_write_strlen(int, const char *, ...); size_t printflike2 screen_write_strlen(int, const char *, ...);
void printflike3 screen_write_puts(struct screen_write_ctx *, void printflike3 screen_write_puts(struct screen_write_ctx *,
struct grid_cell *, const char *, ...); struct grid_cell *, const char *, ...);
void printflike5 screen_write_nputs(struct screen_write_ctx *, void printflike5 screen_write_nputs(struct screen_write_ctx *,
ssize_t, struct grid_cell *, int, const char *, ...); ssize_t, struct grid_cell *, int, const char *, ...);
void screen_write_vnputs(struct screen_write_ctx *, void screen_write_vnputs(struct screen_write_ctx *,
ssize_t, struct grid_cell *, int, const char *, va_list); ssize_t, struct grid_cell *, int, const char *, va_list);
void screen_write_parsestyle( void screen_write_parsestyle(
struct grid_cell *, struct grid_cell *, const char *); struct grid_cell *, struct grid_cell *, const char *);
void screen_write_putc( void screen_write_putc(
struct screen_write_ctx *, struct grid_cell *, u_char); struct screen_write_ctx *, struct grid_cell *, u_char);
void screen_write_copy(struct screen_write_ctx *, void screen_write_copy(struct screen_write_ctx *,
struct screen *, u_int, u_int, u_int, u_int); struct screen *, u_int, u_int, u_int, u_int);
void screen_write_backspace(struct screen_write_ctx *); void screen_write_backspace(struct screen_write_ctx *);
@ -1747,7 +1747,7 @@ void screen_write_clearendofscreen(struct screen_write_ctx *);
void screen_write_clearstartofscreen(struct screen_write_ctx *); void screen_write_clearstartofscreen(struct screen_write_ctx *);
void screen_write_clearscreen(struct screen_write_ctx *); void screen_write_clearscreen(struct screen_write_ctx *);
void screen_write_cell(struct screen_write_ctx *, void screen_write_cell(struct screen_write_ctx *,
const struct grid_cell *, const struct utf8_data *); const struct grid_cell *, const struct utf8_data *);
/* screen-redraw.c */ /* screen-redraw.c */
void screen_redraw_screen(struct client *, int); void screen_redraw_screen(struct client *, int);
@ -1772,7 +1772,7 @@ int winlink_cmp(struct winlink *, struct winlink *);
RB_PROTOTYPE(windows, window, entry, window_cmp); RB_PROTOTYPE(windows, window, entry, window_cmp);
RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp); RB_PROTOTYPE(winlinks, winlink, entry, winlink_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 *);
int winlink_next_index(struct winlinks *, 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 *, struct window *, int); struct winlink *winlink_add(struct winlinks *, struct window *, int);
@ -1781,11 +1781,11 @@ struct winlink *winlink_next(struct winlink *);
struct winlink *winlink_previous(struct winlink *); struct winlink *winlink_previous(struct winlink *);
void winlink_stack_push(struct winlink_stack *, struct winlink *); void winlink_stack_push(struct winlink_stack *, struct winlink *);
void winlink_stack_remove(struct winlink_stack *, struct winlink *); void winlink_stack_remove(struct winlink_stack *, struct winlink *);
int window_index(struct window *, u_int *); int window_index(struct window *, u_int *);
struct window *window_create1(u_int, u_int); struct window *window_create1(u_int, u_int);
struct window *window_create(const char *, const char *, const char *, struct window *window_create(const char *, const char *, const char *,
const char *, struct environ *, struct termios *, const char *, struct environ *, struct termios *,
u_int, u_int, u_int, char **); u_int, u_int, u_int, char **);
void window_destroy(struct window *); void window_destroy(struct window *);
void window_set_active_at(struct window *, u_int, u_int); void window_set_active_at(struct window *, u_int, u_int);
void window_set_active_pane(struct window *, struct window_pane *); void window_set_active_pane(struct window *, struct window_pane *);
@ -1808,10 +1808,10 @@ void window_pane_reset_mode(struct window_pane *);
void window_pane_parse(struct window_pane *); void window_pane_parse(struct window_pane *);
void window_pane_key(struct window_pane *, struct client *, int); void window_pane_key(struct window_pane *, struct client *, int);
void window_pane_mouse(struct window_pane *, void window_pane_mouse(struct window_pane *,
struct client *, struct mouse_event *); struct client *, struct mouse_event *);
int window_pane_visible(struct window_pane *); int window_pane_visible(struct window_pane *);
char *window_pane_search( char *window_pane_search(
struct window_pane *, const char *, u_int *); struct window_pane *, const char *, u_int *);
/* layout.c */ /* layout.c */
struct layout_cell *layout_create_cell(struct layout_cell *); struct layout_cell *layout_create_cell(struct layout_cell *);
@ -1831,7 +1831,7 @@ void layout_init(struct window *);
void layout_free(struct window *); void layout_free(struct window *);
void layout_resize(struct window *, u_int, u_int); void layout_resize(struct window *, u_int, u_int);
void layout_resize_pane( void layout_resize_pane(
struct window_pane *, enum layout_type, int); struct window_pane *, enum layout_type, int);
int layout_split_pane(struct window_pane *, int layout_split_pane(struct window_pane *,
enum layout_type, int, struct window_pane *); enum layout_type, int, struct window_pane *);
void layout_close_pane(struct window_pane *); void layout_close_pane(struct window_pane *);
@ -1849,24 +1849,24 @@ extern const struct window_mode window_clock_mode;
/* window-copy.c */ /* window-copy.c */
extern const struct window_mode window_copy_mode; extern const struct window_mode window_copy_mode;
void window_copy_pageup(struct window_pane *); void window_copy_pageup(struct window_pane *);
/* window-more.c */ /* window-more.c */
extern const struct window_mode window_more_mode; extern const struct window_mode window_more_mode;
void window_more_vadd(struct window_pane *, const char *, va_list); void window_more_vadd(struct window_pane *, const char *, va_list);
/* window-choose.c */ /* window-choose.c */
extern const struct window_mode window_choose_mode; extern const struct window_mode window_choose_mode;
void window_choose_vadd( void window_choose_vadd(
struct window_pane *, int, const char *, va_list); struct window_pane *, int, const char *, va_list);
void printflike3 window_choose_add( void printflike3 window_choose_add(
struct window_pane *, int, const char *, ...); struct window_pane *, int, const char *, ...);
void window_choose_ready(struct window_pane *, void window_choose_ready(struct window_pane *,
u_int, void (*)(void *, int), void (*)(void *), void *); u_int, void (*)(void *, int), void (*)(void *), void *);
/* names.c */ /* names.c */
void queue_window_name(struct window *); void queue_window_name(struct window *);
char *default_window_name(struct window *); char *default_window_name(struct window *);
/* session.c */ /* session.c */
extern struct sessions sessions; extern struct sessions sessions;
@ -1880,12 +1880,12 @@ struct session *session_find(const char *);
struct session *session_create(const char *, const char *, const char *, struct session *session_create(const char *, const char *, const char *,
struct environ *, struct termios *, int, u_int, u_int, struct environ *, struct termios *, int, u_int, u_int,
char **); char **);
void session_destroy(struct session *); void session_destroy(struct session *);
int session_index(struct session *, u_int *); int session_index(struct session *, u_int *);
struct winlink *session_new(struct session *, struct winlink *session_new(struct session *,
const char *, const char *, const char *, int, char **); const char *, const char *, const char *, int, char **);
struct winlink *session_attach( struct winlink *session_attach(
struct session *, struct window *, int, char **); struct session *, struct window *, int, char **);
int session_detach(struct session *, struct winlink *); int session_detach(struct session *, struct winlink *);
int session_has(struct session *, struct window *); int session_has(struct session *, struct window *);
int session_next(struct session *, int); int session_next(struct session *, int);

View File

@ -35,7 +35,7 @@ void tty_keys_add1(struct tty_key **, const char *, int);
void tty_keys_add(struct tty *, const char *, int); void tty_keys_add(struct tty *, const char *, int);
void tty_keys_free1(struct tty_key *); void tty_keys_free1(struct tty_key *);
struct tty_key *tty_keys_find1( struct tty_key *tty_keys_find1(
struct tty_key *, const char *, size_t, size_t *); struct tty_key *, const char *, size_t, size_t *);
struct tty_key *tty_keys_find(struct tty *, const char *, size_t, size_t *); struct tty_key *tty_keys_find(struct tty *, const char *, size_t, size_t *);
void tty_keys_callback(int, short, void *); void tty_keys_callback(int, short, void *);
int tty_keys_mouse( int tty_keys_mouse(
@ -548,7 +548,7 @@ found_key:
goto handle_key; goto handle_key;
handle_key: handle_key:
evtimer_del(&tty->key_timer); evtimer_del(&tty->key_timer);
tty->key_callback(key, &mouse, tty->key_data); tty->key_callback(key, &mouse, tty->key_data);

View File

@ -239,7 +239,7 @@ tty_term_override(struct tty_term *term, const char *overrides)
val = NULL; val = NULL;
removeflag = 0; removeflag = 0;
if ((ptr = strchr(entstr, '=')) != NULL) { if ((ptr = strchr(entstr, '=')) != NULL) {
*ptr++ = '\0'; *ptr++ = '\0';
val = xstrdup(ptr); val = xstrdup(ptr);
if (strunvis(val, ptr) == -1) { if (strunvis(val, ptr) == -1) {
@ -321,10 +321,12 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause)
if (setupterm(name, fd, &error) != OK) { if (setupterm(name, fd, &error) != OK) {
switch (error) { switch (error) {
case 1: case 1:
xasprintf(cause, "can't use hardcopy terminal: %s", name); xasprintf(
cause, "can't use hardcopy terminal: %s", name);
break; break;
case 0: case 0:
xasprintf(cause, "missing or unsuitable terminal: %s", name); xasprintf(
cause, "missing or unsuitable terminal: %s", name);
break; break;
case -1: case -1:
xasprintf(cause, "can't find terminfo database"); xasprintf(cause, "can't find terminfo database");

56
tty.c
View File

@ -44,7 +44,7 @@ void tty_redraw_region(struct tty *, const struct tty_ctx *);
void tty_emulate_repeat( void tty_emulate_repeat(
struct tty *, enum tty_code_code, enum tty_code_code, u_int); struct tty *, enum tty_code_code, enum tty_code_code, u_int);
void tty_cell(struct tty *, void tty_cell(struct tty *,
const struct grid_cell *, const struct grid_utf8 *); const struct grid_cell *, const struct grid_utf8 *);
void void
tty_init(struct tty *tty, int fd, char *term) tty_init(struct tty *tty, int fd, char *term)
@ -562,7 +562,7 @@ tty_write(void (*cmdfn)(
void void
tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i; u_int i;
@ -573,7 +573,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
tty_reset(tty); tty_reset(tty);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
if (tty_term_has(tty->term, TTYC_ICH) || if (tty_term_has(tty->term, TTYC_ICH) ||
tty_term_has(tty->term, TTYC_ICH1)) tty_term_has(tty->term, TTYC_ICH1))
@ -591,7 +591,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
@ -603,7 +603,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
tty_reset(tty); tty_reset(tty);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
if (tty_term_has(tty->term, TTYC_DCH) || if (tty_term_has(tty->term, TTYC_DCH) ||
tty_term_has(tty->term, TTYC_DCH1)) tty_term_has(tty->term, TTYC_DCH1))
@ -613,10 +613,10 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
!tty_term_has(tty->term, TTYC_IL1)) { !tty_term_has(tty->term, TTYC_IL1)) {
tty_redraw_region(tty, ctx); tty_redraw_region(tty, ctx);
@ -625,8 +625,8 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
tty_reset(tty); tty_reset(tty);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num); tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
} }
@ -634,10 +634,10 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
!tty_term_has(tty->term, TTYC_DL1)) { !tty_term_has(tty->term, TTYC_DL1)) {
tty_redraw_region(tty, ctx); tty_redraw_region(tty, ctx);
@ -646,8 +646,8 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
tty_reset(tty); tty_reset(tty);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num); tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
} }
@ -655,13 +655,13 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i; u_int i;
tty_reset(tty); tty_reset(tty);
tty_cursor_pane(tty, ctx, 0, ctx->ocy); tty_cursor_pane(tty, ctx, 0, ctx->ocy);
if (wp->xoff == 0 && screen_size_x(s) >= tty->sx && if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
tty_term_has(tty->term, TTYC_EL)) { tty_term_has(tty->term, TTYC_EL)) {
@ -675,7 +675,7 @@ tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i; u_int i;
@ -695,7 +695,7 @@ tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
u_int i; u_int i;
tty_reset(tty); tty_reset(tty);
@ -713,13 +713,13 @@ tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
if (ctx->ocy != ctx->orupper) if (ctx->ocy != ctx->orupper)
return; return;
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
!tty_term_has(tty->term, TTYC_RI)) { !tty_term_has(tty->term, TTYC_RI)) {
tty_redraw_region(tty, ctx); tty_redraw_region(tty, ctx);
@ -737,13 +737,13 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
if (ctx->ocy != ctx->orlower) if (ctx->ocy != ctx->orlower)
return; return;
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
!tty_term_has(tty->term, TTYC_CSR)) { !tty_term_has(tty->term, TTYC_CSR)) {
tty_redraw_region(tty, ctx); tty_redraw_region(tty, ctx);
return; return;
@ -768,7 +768,7 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i, j; u_int i, j;
@ -804,7 +804,7 @@ tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i, j; u_int i, j;
@ -834,7 +834,7 @@ tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i, j; u_int i, j;
@ -980,7 +980,7 @@ void
tty_region_pane( tty_region_pane(
struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower) struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
tty_region(tty, wp->yoff + rupper, wp->yoff + rlower); tty_region(tty, wp->yoff + rupper, wp->yoff + rlower);
} }
@ -1016,7 +1016,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower)
void 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)
{ {
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
tty_cursor(tty, wp->xoff + cx, wp->yoff + cy); tty_cursor(tty, wp->xoff + cx, wp->yoff + cy);
} }
@ -1120,8 +1120,8 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
change = thisy - cy; /* +ve up, -ve down */ change = thisy - cy; /* +ve up, -ve down */
/* /*
* Try to use VPA if change is larger than absolute or if this change * Try to use VPA if change is larger than absolute or if this
* would cross the scroll region, otherwise use CUU/CUD. * change would cross the scroll region, otherwise use CUU/CUD.
*/ */
if (abs(change) > cy || if (abs(change) > cy ||
(change < 0 && cy - change > tty->rlower) || (change < 0 && cy - change > tty->rlower) ||

View File

@ -27,11 +27,11 @@ void window_choose_free(struct window_pane *);
void window_choose_resize(struct window_pane *, u_int, u_int); void window_choose_resize(struct window_pane *, u_int, u_int);
void window_choose_key(struct window_pane *, struct client *, int); void window_choose_key(struct window_pane *, struct client *, int);
void window_choose_mouse( void window_choose_mouse(
struct window_pane *, struct client *, struct mouse_event *); struct window_pane *, struct client *, struct mouse_event *);
void window_choose_redraw_screen(struct window_pane *); void window_choose_redraw_screen(struct window_pane *);
void window_choose_write_line( void window_choose_write_line(
struct window_pane *, struct screen_write_ctx *, u_int); struct window_pane *, struct screen_write_ctx *, u_int);
void window_choose_scroll_up(struct window_pane *); void window_choose_scroll_up(struct window_pane *);
void window_choose_scroll_down(struct window_pane *); void window_choose_scroll_down(struct window_pane *);
@ -247,7 +247,7 @@ window_choose_key(struct window_pane *wp, unused struct client *c, int key)
else else
data->top -= screen_size_y(s); data->top -= screen_size_y(s);
} }
window_choose_redraw_screen(wp); window_choose_redraw_screen(wp);
break; break;
case MODEKEYCHOICE_PAGEDOWN: case MODEKEYCHOICE_PAGEDOWN:
data->selected += screen_size_y(s); data->selected += screen_size_y(s);
@ -312,7 +312,7 @@ window_choose_write_line(
struct options *oo = &wp->window->options; struct options *oo = &wp->window->options;
struct screen *s = &data->screen; struct screen *s = &data->screen;
struct grid_cell gc; struct grid_cell gc;
int utf8flag; int utf8flag;
char key; char key;
if (data->callbackfn == NULL) if (data->callbackfn == NULL)

View File

@ -78,7 +78,7 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy)
struct window_clock_mode_data *data = wp->modedata; struct window_clock_mode_data *data = wp->modedata;
struct screen *s = &data->screen; struct screen *s = &data->screen;
screen_resize(s, sx, sy); screen_resize(s, sx, sy);
window_clock_draw_screen(wp); window_clock_draw_screen(wp);
} }

View File

@ -29,14 +29,14 @@ void window_copy_resize(struct window_pane *, u_int, u_int);
void window_copy_key(struct window_pane *, struct client *, int); void window_copy_key(struct window_pane *, struct client *, int);
int window_copy_key_input(struct window_pane *, int); int window_copy_key_input(struct window_pane *, int);
void window_copy_mouse( void window_copy_mouse(
struct window_pane *, struct client *, struct mouse_event *); struct window_pane *, struct client *, struct mouse_event *);
void window_copy_redraw_lines(struct window_pane *, u_int, 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_redraw_screen(struct window_pane *);
void window_copy_write_line( void window_copy_write_line(
struct window_pane *, struct screen_write_ctx *, u_int); struct window_pane *, struct screen_write_ctx *, u_int);
void window_copy_write_lines( void window_copy_write_lines(
struct window_pane *, struct screen_write_ctx *, u_int, u_int); struct window_pane *, struct screen_write_ctx *, u_int, u_int);
void window_copy_scroll_to(struct window_pane *, u_int, u_int); void window_copy_scroll_to(struct window_pane *, u_int, u_int);
int window_copy_search_compare( int window_copy_search_compare(
@ -233,7 +233,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
return; return;
case MODEKEYCOPY_RIGHT: case MODEKEYCOPY_RIGHT:
window_copy_cursor_right(wp); window_copy_cursor_right(wp);
return; return;
case MODEKEYCOPY_UP: case MODEKEYCOPY_UP:
window_copy_cursor_up(wp, 0); window_copy_cursor_up(wp, 0);
return; return;
@ -297,7 +297,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
break; break;
case MODEKEYCOPY_STARTSELECTION: case MODEKEYCOPY_STARTSELECTION:
window_copy_start_selection(wp); window_copy_start_selection(wp);
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
break; break;
case MODEKEYCOPY_CLEARSELECTION: case MODEKEYCOPY_CLEARSELECTION:
@ -452,7 +452,7 @@ window_copy_mouse(
window_copy_update_cursor(wp, m->x, m->y); window_copy_update_cursor(wp, m->x, m->y);
if (window_copy_update_selection(wp)) if (window_copy_update_selection(wp))
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
} }
void void
@ -476,7 +476,7 @@ window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py)
offset = py + gap - gd->sy; offset = py + gap - gd->sy;
data->cy = py - offset; data->cy = py - offset;
} }
data->oy = gd->hsize - offset; data->oy = gd->hsize - offset;
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
} }
@ -893,8 +893,8 @@ window_copy_copy_line(struct window_pane *wp,
char **buf, size_t *off, u_int sy, u_int sx, u_int ex) char **buf, size_t *off, u_int sy, u_int sx, u_int ex)
{ {
struct grid *gd = wp->base.grid; struct grid *gd = wp->base.grid;
const struct grid_cell *gc; const struct grid_cell *gc;
const struct grid_utf8 *gu; const struct grid_utf8 *gu;
struct grid_line *gl; struct grid_line *gl;
u_int i, xx, wrapped = 0; u_int i, xx, wrapped = 0;
size_t size; size_t size;
@ -907,7 +907,7 @@ window_copy_copy_line(struct window_pane *wp,
* on screen. * on screen.
*/ */
gl = &gd->linedata[sy]; gl = &gd->linedata[sy];
if (gl->flags & GRID_LINE_WRAPPED && gl->cellsize <= gd->sx) if (gl->flags & GRID_LINE_WRAPPED && gl->cellsize <= gd->sx)
wrapped = 1; wrapped = 1;
/* If the line was wrapped, don't strip spaces (use the full length). */ /* If the line was wrapped, don't strip spaces (use the full length). */
@ -938,7 +938,7 @@ window_copy_copy_line(struct window_pane *wp,
} }
/* Only add a newline if the line wasn't wrapped. */ /* Only add a newline if the line wasn't wrapped. */
if (!wrapped) { if (!wrapped) {
*buf = xrealloc(*buf, 1, (*off) + 1); *buf = xrealloc(*buf, 1, (*off) + 1);
(*buf)[(*off)++] = '\n'; (*buf)[(*off)++] = '\n';
} }

View File

@ -29,7 +29,7 @@ void window_more_key(struct window_pane *, struct client *, int);
void window_more_redraw_screen(struct window_pane *); void window_more_redraw_screen(struct window_pane *);
void window_more_write_line( void window_more_write_line(
struct window_pane *, struct screen_write_ctx *, u_int); struct window_pane *, struct screen_write_ctx *, u_int);
void window_more_scroll_up(struct window_pane *); void window_more_scroll_up(struct window_pane *);
void window_more_scroll_down(struct window_pane *); void window_more_scroll_down(struct window_pane *);
@ -169,7 +169,7 @@ window_more_write_line(
struct grid_cell gc; struct grid_cell gc;
char *msg, hdr[32]; char *msg, hdr[32];
size_t size; size_t size;
int utf8flag; int utf8flag;
utf8flag = options_get_number(&wp->window->options, "utf8"); utf8flag = options_get_number(&wp->window->options, "utf8");
memcpy(&gc, &grid_default_cell, sizeof gc); memcpy(&gc, &grid_default_cell, sizeof gc);

View File

@ -428,7 +428,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
wp->layout_cell = NULL; wp->layout_cell = NULL;
wp->xoff = 0; wp->xoff = 0;
wp->yoff = 0; wp->yoff = 0;
wp->sx = sx; wp->sx = sx;
wp->sy = sy; wp->sy = sy;
@ -513,7 +513,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
ws.ws_col = screen_size_x(&wp->base); ws.ws_col = screen_size_x(&wp->base);
ws.ws_row = screen_size_y(&wp->base); ws.ws_row = screen_size_y(&wp->base);
switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) { switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
case -1: case -1:
wp->fd = -1; wp->fd = -1;
xasprintf(cause, "%s: %s", cmd, strerror(errno)); xasprintf(cause, "%s: %s", cmd, strerror(errno));

View File

@ -132,7 +132,7 @@ xterm_keys_modifiers(const char *template, const char *buf, size_t len)
case '7': case '7':
return (KEYC_ESCAPE|KEYC_CTRL); return (KEYC_ESCAPE|KEYC_CTRL);
case '8': case '8':
return (KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL); return (KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL);
} }
return (0); return (0);
} }