mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-22 23:00:51 +01:00
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:
parent
6c9862662f
commit
15a64b805e
14
client.c
14
client.c
@ -125,7 +125,7 @@ client_send_identify(int flags)
|
|||||||
|
|
||||||
if (getcwd(data.cwd, sizeof data.cwd) == NULL)
|
if (getcwd(data.cwd, sizeof data.cwd) == NULL)
|
||||||
*data.cwd = '\0';
|
*data.cwd = '\0';
|
||||||
|
|
||||||
term = getenv("TERM");
|
term = getenv("TERM");
|
||||||
if (term == NULL ||
|
if (term == NULL ||
|
||||||
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
|
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
|
||||||
@ -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;
|
||||||
@ -263,9 +263,9 @@ client_callback(unused int fd, short events, unused void *data)
|
|||||||
if (client_dispatch() != 0) {
|
if (client_dispatch() != 0) {
|
||||||
event_loopexit(NULL);
|
event_loopexit(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events & EV_WRITE) {
|
if (events & EV_WRITE) {
|
||||||
if (msgbuf_write(&client_ibuf.w) < 0)
|
if (msgbuf_write(&client_ibuf.w) < 0)
|
||||||
goto lost_server;
|
goto lost_server;
|
||||||
@ -341,7 +341,7 @@ client_dispatch(void)
|
|||||||
if (datalen != sizeof lockdata)
|
if (datalen != sizeof lockdata)
|
||||||
fatalx("bad MSG_LOCK size");
|
fatalx("bad MSG_LOCK size");
|
||||||
memcpy(&lockdata, imsg.data, sizeof lockdata);
|
memcpy(&lockdata, imsg.data, sizeof lockdata);
|
||||||
|
|
||||||
lockdata.cmd[(sizeof lockdata.cmd) - 1] = '\0';
|
lockdata.cmd[(sizeof lockdata.cmd) - 1] = '\0';
|
||||||
system(lockdata.cmd);
|
system(lockdata.cmd);
|
||||||
client_write_server(MSG_UNLOCK, NULL, 0);
|
client_write_server(MSG_UNLOCK, NULL, 0);
|
||||||
|
8
clock.c
8
clock.c
@ -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;
|
||||||
|
@ -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,
|
||||||
@ -59,7 +59,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
|
|
||||||
if (ctx->cmdclient == NULL) {
|
if (ctx->cmdclient == NULL) {
|
||||||
if (cmd_check_flag(data->chflags, 'd')) {
|
if (cmd_check_flag(data->chflags, 'd')) {
|
||||||
/*
|
/*
|
||||||
* Can't use server_write_session in case attaching to
|
* Can't use server_write_session in case attaching to
|
||||||
* the same session as currently attached to.
|
* the same session as currently attached to.
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
server_write_client(c, MSG_DETACH, NULL, 0);
|
server_write_client(c, MSG_DETACH, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->curclient->session = s;
|
ctx->curclient->session = s;
|
||||||
server_redraw_client(ctx->curclient);
|
server_redraw_client(ctx->curclient);
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,7 +152,7 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
ctx->error(ctx, "unknown command: %s", data->modecmd);
|
ctx->error(ctx, "unknown command: %s", data->modecmd);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtmp.key = data->key & ~KEYC_PREFIX;
|
mtmp.key = data->key & ~KEYC_PREFIX;
|
||||||
mtmp.mode = data->command_key ? 1 : 0;
|
mtmp.mode = data->command_key ? 1 : 0;
|
||||||
if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
|
if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
|
||||||
|
@ -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);
|
||||||
|
@ -48,7 +48,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
struct screen *s;
|
struct screen *s;
|
||||||
struct session *sess;
|
struct session *sess;
|
||||||
u_int i, limit;
|
u_int i, limit;
|
||||||
size_t len, linelen;
|
size_t len, linelen;
|
||||||
|
|
||||||
if (cmd_find_pane(ctx, data->target, &sess, &wp) == NULL)
|
if (cmd_find_pane(ctx, data->target, &sess, &wp) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -116,10 +116,10 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
cdata->client = ctx->curclient;
|
cdata->client = ctx->curclient;
|
||||||
cdata->client->references++;
|
cdata->client->references++;
|
||||||
|
|
||||||
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
|
||||||
@ -133,7 +133,7 @@ cmd_choose_window_callback(void *data, int idx)
|
|||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
return;
|
return;
|
||||||
if (cdata->client->flags & CLIENT_DEAD)
|
if (cdata->client->flags & CLIENT_DEAD)
|
||||||
return;
|
return;
|
||||||
if (cdata->session->flags & SESSION_DEAD)
|
if (cdata->session->flags & SESSION_DEAD)
|
||||||
return;
|
return;
|
||||||
if (cdata->client->session != cdata->session)
|
if (cdata->client->session != cdata->session)
|
||||||
|
@ -141,7 +141,7 @@ cmd_fill_argument(int flags, char **arg, char **arg2, int argc, char **argv)
|
|||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
*arg2 = xstrdup(argv[1]);
|
*arg2 = xstrdup(argv[1]);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc != 0)
|
if (argc != 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -71,7 +71,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
tmp[50 - 3] = '\0';
|
tmp[50 - 3] = '\0';
|
||||||
strlcat(tmp, "...", sizeof tmp);
|
strlcat(tmp, "...", sizeof tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->print(ctx, "%u: %zu bytes: \"%s\"", idx - 1, size, tmp);
|
ctx->print(ctx, "%u: %zu bytes: \"%s\"", idx - 1, size, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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 *);
|
||||||
@ -56,7 +56,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
n = 0;
|
n = 0;
|
||||||
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
||||||
gd = wp->base.grid;
|
gd = wp->base.grid;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
for (i = 0; i < gd->hsize; i++) {
|
for (i = 0; i < gd->hsize; i++) {
|
||||||
gl = &gd->linedata[i];
|
gl = &gd->linedata[i];
|
||||||
@ -64,7 +64,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
size += gl->utf8size * sizeof *gl->utf8data;
|
size += gl->utf8size * sizeof *gl->utf8data;
|
||||||
}
|
}
|
||||||
size += gd->hsize * sizeof *gd->linedata;
|
size += gd->hsize * sizeof *gd->linedata;
|
||||||
|
|
||||||
ctx->print(ctx, "%u: [%ux%u] [history %u/%u, %llu bytes]",
|
ctx->print(ctx, "%u: [%ux%u] [history %u/%u, %llu bytes]",
|
||||||
n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size);
|
n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size);
|
||||||
n++;
|
n++;
|
||||||
|
@ -184,8 +184,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
ctx->error(ctx, "not a terminal");
|
ctx->error(ctx, "not a terminal");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrides =
|
overrides =
|
||||||
options_get_string(&global_s_options, "terminal-overrides");
|
options_get_string(&global_s_options, "terminal-overrides");
|
||||||
if (tty_open(&ctx->cmdclient->tty, overrides, &cause) != 0) {
|
if (tty_open(&ctx->cmdclient->tty, overrides, &cause) != 0) {
|
||||||
ctx->error(ctx, "open terminal failed: %s", cause);
|
ctx->error(ctx, "open terminal failed: %s", cause);
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
if (!data->flag_detached) {
|
if (!data->flag_detached) {
|
||||||
session_select(s, wl->idx);
|
session_select(s, wl->idx);
|
||||||
server_redraw_session_group(s);
|
server_redraw_session_group(s);
|
||||||
} else
|
} else
|
||||||
server_status_session_group(s);
|
server_status_session_group(s);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -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'. */
|
||||||
|
@ -87,7 +87,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
switch (fork()) {
|
switch (fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
ctx->error(ctx, "fork error: %s", strerror(errno));
|
ctx->error(ctx, "fork error: %s", strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
case 0:
|
case 0:
|
||||||
/* Child process. */
|
/* Child process. */
|
||||||
close(pipe_fd[0]);
|
close(pipe_fd[0]);
|
||||||
@ -114,17 +114,17 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
|
|
||||||
wp->pipe_fd = pipe_fd[0];
|
wp->pipe_fd = pipe_fd[0];
|
||||||
wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
|
wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
|
||||||
|
|
||||||
wp->pipe_event = bufferevent_new(wp->pipe_fd,
|
wp->pipe_event = bufferevent_new(wp->pipe_fd,
|
||||||
NULL, NULL, cmd_pipe_pane_error_callback, wp);
|
NULL, NULL, cmd_pipe_pane_error_callback, wp);
|
||||||
bufferevent_enable(wp->pipe_event, EV_WRITE);
|
bufferevent_enable(wp->pipe_event, EV_WRITE);
|
||||||
|
|
||||||
if ((mode = fcntl(wp->pipe_fd, F_GETFL)) == -1)
|
if ((mode = fcntl(wp->pipe_fd, F_GETFL)) == -1)
|
||||||
fatal("fcntl failed");
|
fatal("fcntl failed");
|
||||||
if (fcntl(wp->pipe_fd, F_SETFL, mode|O_NONBLOCK) == -1)
|
if (fcntl(wp->pipe_fd, F_SETFL, mode|O_NONBLOCK) == -1)
|
||||||
fatal("fcntl failed");
|
fatal("fcntl failed");
|
||||||
if (fcntl(wp->pipe_fd, F_SETFD, FD_CLOEXEC) == -1)
|
if (fcntl(wp->pipe_fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||||
fatal("fcntl failed");
|
fatal("fcntl failed");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ cmd_previous_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
struct cmd_target_data *data = self->data;
|
struct cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
u_int layout;
|
u_int layout;
|
||||||
|
|
||||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ cmd_resize_pane_init(struct cmd *self, int key)
|
|||||||
cmd_set_flag(&data->chflags, 'L');
|
cmd_set_flag(&data->chflags, 'L');
|
||||||
if (key == (KEYC_RIGHT | KEYC_CTRL))
|
if (key == (KEYC_RIGHT | KEYC_CTRL))
|
||||||
cmd_set_flag(&data->chflags, 'R');
|
cmd_set_flag(&data->chflags, 'R');
|
||||||
|
|
||||||
if (key == (KEYC_UP | KEYC_ESCAPE)) {
|
if (key == (KEYC_UP | KEYC_ESCAPE)) {
|
||||||
cmd_set_flag(&data->chflags, 'U');
|
cmd_set_flag(&data->chflags, 'U');
|
||||||
data->arg = xstrdup("5");
|
data->arg = xstrdup("5");
|
||||||
|
@ -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(
|
||||||
|
@ -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;
|
||||||
@ -80,7 +80,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
ctx->error(ctx, "unknown layout or ambiguous: %s", data->arg);
|
ctx->error(ctx, "unknown layout or ambiguous: %s", data->arg);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout = layout_set_select(wl->window, layout);
|
layout = layout_set_select(wl->window, layout);
|
||||||
ctx->info(ctx, "arranging in: %s", layout_set_name(layout));
|
ctx->info(ctx, "arranging in: %s", layout_set_name(layout));
|
||||||
|
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
ctx->print(ctx, "%2d: %s (%d, %d): %s [%ux%u %s] "
|
ctx->print(ctx, "%2d: %s (%d, %d): %s [%ux%u %s] "
|
||||||
"[flags=0x%x/0x%x, references=%u]", i, c->tty.path,
|
"[flags=0x%x/0x%x, references=%u]", i, c->tty.path,
|
||||||
c->ibuf.fd, c->tty.fd, c->session->name,
|
c->ibuf.fd, c->tty.fd, c->session->name,
|
||||||
c->tty.sx, c->tty.sy, c->tty.termname, c->flags,
|
c->tty.sx, c->tty.sy, c->tty.termname, c->flags,
|
||||||
c->tty.flags, c->references);
|
c->tty.flags, c->references);
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
@ -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",
|
||||||
@ -103,7 +103,7 @@ const struct set_option_entry set_session_option_table[] = {
|
|||||||
{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
|
{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
|
||||||
{ "status-fg", SET_OPTION_COLOUR, 0, 0, NULL },
|
{ "status-fg", SET_OPTION_COLOUR, 0, 0, NULL },
|
||||||
{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
|
{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
|
||||||
{ "status-justify",
|
{ "status-justify",
|
||||||
SET_OPTION_CHOICE, 0, 0, set_option_status_justify_list },
|
SET_OPTION_CHOICE, 0, 0, set_option_status_justify_list },
|
||||||
{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
|
{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
|
||||||
{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
|
{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
|
||||||
@ -116,11 +116,11 @@ const struct set_option_entry set_session_option_table[] = {
|
|||||||
{ "status-right-bg", SET_OPTION_COLOUR, 0, 0, NULL },
|
{ "status-right-bg", SET_OPTION_COLOUR, 0, 0, NULL },
|
||||||
{ "status-right-fg", SET_OPTION_COLOUR, 0, 0, NULL },
|
{ "status-right-fg", SET_OPTION_COLOUR, 0, 0, NULL },
|
||||||
{ "status-right-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
|
{ "status-right-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
|
||||||
{ "status-utf8", SET_OPTION_FLAG, 0, 0, NULL },
|
{ "status-utf8", SET_OPTION_FLAG, 0, 0, NULL },
|
||||||
{ "terminal-overrides", SET_OPTION_STRING, 0, 0, NULL },
|
{ "terminal-overrides", SET_OPTION_STRING, 0, 0, NULL },
|
||||||
{ "update-environment", SET_OPTION_STRING, 0, 0, NULL },
|
{ "update-environment", SET_OPTION_STRING, 0, 0, NULL },
|
||||||
{ "visual-activity", SET_OPTION_FLAG, 0, 0, NULL },
|
{ "visual-activity", SET_OPTION_FLAG, 0, 0, NULL },
|
||||||
{ "visual-bell", SET_OPTION_FLAG, 0, 0, NULL },
|
{ "visual-bell", SET_OPTION_FLAG, 0, 0, NULL },
|
||||||
{ "visual-content", SET_OPTION_FLAG, 0, 0, NULL },
|
{ "visual-content", SET_OPTION_FLAG, 0, 0, NULL },
|
||||||
{ NULL, 0, 0, 0, NULL }
|
{ NULL, 0, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
@ -266,7 +266,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
server_redraw_client(c);
|
server_redraw_client(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special-case: kill all persistent jobs if status-left, status-right
|
* Special-case: kill all persistent jobs if status-left, status-right
|
||||||
* or set-titles-string have changed. Persistent jobs are only used by
|
* or set-titles-string have changed. Persistent jobs are only used by
|
||||||
* the status line at the moment so this works XXX.
|
* the status line at the moment so this works XXX.
|
||||||
@ -282,7 +282,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
|
|
||||||
jobs = &c->status_jobs;
|
jobs = &c->status_jobs;
|
||||||
do {
|
do {
|
||||||
try_again = 0;
|
try_again = 0;
|
||||||
job = RB_ROOT(jobs);
|
job = RB_ROOT(jobs);
|
||||||
while (job != NULL) {
|
while (job != NULL) {
|
||||||
nextjob = RB_NEXT(jobs, jobs, job);
|
nextjob = RB_NEXT(jobs, jobs, job);
|
||||||
@ -366,7 +366,7 @@ cmd_set_option_string(struct cmd_ctx *ctx, struct options *oo,
|
|||||||
xasprintf(&newvalue, "%s%s", oldvalue, value);
|
xasprintf(&newvalue, "%s%s", oldvalue, value);
|
||||||
} else
|
} else
|
||||||
newvalue = value;
|
newvalue = value;
|
||||||
|
|
||||||
o = options_set_string(oo, entry->name, "%s", newvalue);
|
o = options_set_string(oo, entry->name, "%s", newvalue);
|
||||||
ctx->info(ctx,
|
ctx->info(ctx,
|
||||||
"set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
|
"set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
|
||||||
|
@ -73,24 +73,24 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
width = s->sx;
|
width = s->sx;
|
||||||
if (ctx->cmdclient != NULL)
|
if (ctx->cmdclient != NULL)
|
||||||
width = ctx->cmdclient->tty.sx;
|
width = ctx->cmdclient->tty.sx;
|
||||||
|
|
||||||
buf = xmalloc(width + 1);
|
buf = xmalloc(width + 1);
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
ptr = in;
|
ptr = in;
|
||||||
do {
|
do {
|
||||||
buf[len++] = *ptr++;
|
buf[len++] = *ptr++;
|
||||||
|
|
||||||
if (len == width || buf[len - 1] == '\n') {
|
if (len == width || buf[len - 1] == '\n') {
|
||||||
if (buf[len - 1] == '\n')
|
if (buf[len - 1] == '\n')
|
||||||
len--;
|
len--;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
ctx->print(ctx, "%s", buf);
|
ctx->print(ctx, "%s", buf);
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
} while (*ptr != '\0');
|
} while (*ptr != '\0');
|
||||||
|
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
ctx->print(ctx, "%s", buf);
|
ctx->print(ctx, "%s", buf);
|
||||||
|
@ -57,7 +57,7 @@ cmd_show_messages_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
|
|
||||||
tim = ctime(&msg->msg_time);
|
tim = ctime(&msg->msg_time);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
|
|
||||||
ctx->print(ctx, "%s %s", tim, msg->msg);
|
ctx->print(ctx, "%s %s", tim, msg->msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const struct cmd_entry cmd_show_options_entry = {
|
|||||||
int
|
int
|
||||||
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_target_data *data = self->data;
|
struct cmd_target_data *data = self->data;
|
||||||
const struct set_option_entry *table;
|
const struct set_option_entry *table;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
@ -70,7 +70,7 @@ cmd_split_window_init(struct cmd *self, int key)
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case '%':
|
case '%':
|
||||||
data->flag_horizontal = 1;
|
data->flag_horizontal = 1;
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
data->flag_horizontal = 0;
|
data->flag_horizontal = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -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';
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
dst_wp->layout_cell = src_lc;
|
dst_wp->layout_cell = src_lc;
|
||||||
dst_lc->wp = src_wp;
|
dst_lc->wp = src_wp;
|
||||||
src_wp->layout_cell = dst_lc;
|
src_wp->layout_cell = dst_lc;
|
||||||
|
|
||||||
src_wp->window = dst_w;
|
src_wp->window = dst_w;
|
||||||
dst_wp->window = src_w;
|
dst_wp->window = src_w;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
ctx->error(ctx, "window is only linked to one session");
|
ctx->error(ctx, "window is only linked to one session");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
server_unlink_window(s, wl);
|
server_unlink_window(s, wl);
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
|
|
||||||
|
22
cmd.c
22
cmd.c
@ -169,7 +169,7 @@ cmd_free_argv(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (argv[i] != NULL)
|
if (argv[i] != NULL)
|
||||||
xfree(argv[i]);
|
xfree(argv[i]);
|
||||||
@ -510,7 +510,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
|
|||||||
* be unique so an exact match can't be ambigious and can just be
|
* be unique so an exact match can't be ambigious and can just be
|
||||||
* returned.
|
* returned.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
|
if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(name, s->name) == 0)
|
if (strcmp(name, s->name) == 0)
|
||||||
@ -522,7 +522,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
|
|||||||
* be ambiguous.
|
* be ambiguous.
|
||||||
*/
|
*/
|
||||||
sfound = NULL;
|
sfound = NULL;
|
||||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
|
if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (strncmp(name, s->name, strlen(name)) == 0 ||
|
if (strncmp(name, s->name, strlen(name)) == 0 ||
|
||||||
@ -534,7 +534,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
|
|||||||
sfound = s;
|
sfound = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (sfound);
|
return (sfound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -558,7 +558,7 @@ cmd_lookup_window(struct session *s, const char *name, int *ambiguous)
|
|||||||
if ((wl = winlink_find_by_index(&s->windows, idx)) != NULL)
|
if ((wl = winlink_find_by_index(&s->windows, idx)) != NULL)
|
||||||
return (wl);
|
return (wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for exact matches, error if more than one. */
|
/* Look for exact matches, error if more than one. */
|
||||||
wlfound = NULL;
|
wlfound = NULL;
|
||||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
@ -584,7 +584,7 @@ cmd_lookup_window(struct session *s, const char *name, int *ambiguous)
|
|||||||
}
|
}
|
||||||
wlfound = wl;
|
wlfound = wl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wlfound != NULL)
|
if (wlfound != NULL)
|
||||||
return (wlfound);
|
return (wlfound);
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp)
|
|||||||
wl = s->curw;
|
wl = s->curw;
|
||||||
else if ((wl = cmd_lookup_window(s, winptr, &ambiguous)) == NULL)
|
else if ((wl = cmd_lookup_window(s, winptr, &ambiguous)) == NULL)
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
if (sessptr != NULL)
|
if (sessptr != NULL)
|
||||||
xfree(sessptr);
|
xfree(sessptr);
|
||||||
return (wl);
|
return (wl);
|
||||||
@ -808,7 +808,7 @@ cmd_find_index(struct cmd_ctx *ctx, const char *arg, struct session **sp)
|
|||||||
ctx->error(ctx, "invalid index: %s", arg);
|
ctx->error(ctx, "invalid index: %s", arg);
|
||||||
idx = -2;
|
idx = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sessptr != NULL)
|
if (sessptr != NULL)
|
||||||
xfree(sessptr);
|
xfree(sessptr);
|
||||||
return (idx);
|
return (idx);
|
||||||
@ -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)
|
||||||
@ -918,7 +918,7 @@ no_period:
|
|||||||
/* Try index in the current session and window. */
|
/* Try index in the current session and window. */
|
||||||
if ((*wpp = window_pane_at_index(s->curw->window, idx)) == NULL)
|
if ((*wpp = window_pane_at_index(s->curw->window, idx)) == NULL)
|
||||||
goto lookup_window;
|
goto lookup_window;
|
||||||
|
|
||||||
return (s->curw);
|
return (s->curw);
|
||||||
|
|
||||||
lookup_window:
|
lookup_window:
|
||||||
@ -926,7 +926,7 @@ lookup_window:
|
|||||||
if ((wl = cmd_find_window(ctx, arg, sp)) != NULL)
|
if ((wl = cmd_find_window(ctx, arg, sp)) != NULL)
|
||||||
*wpp = wl->window->active;
|
*wpp = wl->window->active;
|
||||||
return (wl);
|
return (wl);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
xfree(winptr);
|
xfree(winptr);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -92,5 +92,5 @@ grid_utf8_compare(const struct grid_utf8 *gu1, const struct grid_utf8 *gu2)
|
|||||||
return (0);
|
return (0);
|
||||||
if (memcmp(gu1->data, gu2->data, size) != 0)
|
if (memcmp(gu1->data, gu2->data, size) != 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -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. */
|
||||||
|
26
grid.c
26
grid.c
@ -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;
|
||||||
@ -183,7 +183,7 @@ grid_collect_history(struct grid *gd)
|
|||||||
gd->hsize -= yy;
|
gd->hsize -= yy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scroll the entire visible screen, moving one line into the history. Just
|
* Scroll the entire visible screen, moving one line into the history. Just
|
||||||
* allocate a new line at the bottom and move the history size indicator.
|
* allocate a new line at the bottom and move the history size indicator.
|
||||||
*/
|
*/
|
||||||
@ -192,12 +192,12 @@ 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);
|
||||||
memset(&gd->linedata[yy], 0, sizeof gd->linedata[yy]);
|
memset(&gd->linedata[yy], 0, sizeof gd->linedata[yy]);
|
||||||
|
|
||||||
gd->hsize++;
|
gd->hsize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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;
|
||||||
@ -535,14 +535,14 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
|
|||||||
buf[off++] = gc->data;
|
buf[off++] = gc->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (off > 0 && buf[off - 1] == ' ')
|
while (off > 0 && buf[off - 1] == ' ')
|
||||||
off--;
|
off--;
|
||||||
buf[off] = '\0';
|
buf[off] = '\0';
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Duplicate a set of lines between two grids. If there aren't enough lines in
|
* Duplicate a set of lines between two grids. If there aren't enough lines in
|
||||||
* either source or destination, the number of lines is limited to the number
|
* either source or destination, the number of lines is limited to the number
|
||||||
* available.
|
* available.
|
||||||
|
@ -81,7 +81,7 @@ struct input_key_ent input_keys[] = {
|
|||||||
{ KEYC_DOWN|KEYC_CTRL, "\033[B", INPUTKEY_CURSOR },
|
{ KEYC_DOWN|KEYC_CTRL, "\033[B", INPUTKEY_CURSOR },
|
||||||
{ KEYC_RIGHT|KEYC_CTRL, "\033[C", INPUTKEY_CURSOR },
|
{ KEYC_RIGHT|KEYC_CTRL, "\033[C", INPUTKEY_CURSOR },
|
||||||
{ KEYC_LEFT|KEYC_CTRL, "\033[D", INPUTKEY_CURSOR },
|
{ KEYC_LEFT|KEYC_CTRL, "\033[D", INPUTKEY_CURSOR },
|
||||||
|
|
||||||
{ KEYC_UP, "\033OA", INPUTKEY_CURSOR },
|
{ KEYC_UP, "\033OA", INPUTKEY_CURSOR },
|
||||||
{ KEYC_DOWN, "\033OB", INPUTKEY_CURSOR },
|
{ KEYC_DOWN, "\033OB", INPUTKEY_CURSOR },
|
||||||
{ KEYC_RIGHT, "\033OC", INPUTKEY_CURSOR },
|
{ KEYC_RIGHT, "\033OC", INPUTKEY_CURSOR },
|
||||||
@ -122,7 +122,7 @@ struct input_key_ent input_keys[] = {
|
|||||||
{ KEYC_KP_EIGHT, "8", 0 },
|
{ KEYC_KP_EIGHT, "8", 0 },
|
||||||
{ KEYC_KP_NINE, "9", 0 },
|
{ KEYC_KP_NINE, "9", 0 },
|
||||||
{ KEYC_KP_PLUS, "+", 0 },
|
{ KEYC_KP_PLUS, "+", 0 },
|
||||||
{ KEYC_KP_FOUR, "4", 0 },
|
{ KEYC_KP_FOUR, "4", 0 },
|
||||||
{ KEYC_KP_FIVE, "5", 0 },
|
{ KEYC_KP_FIVE, "5", 0 },
|
||||||
{ KEYC_KP_SIX, "6", 0 },
|
{ KEYC_KP_SIX, "6", 0 },
|
||||||
{ KEYC_KP_ONE, "1", 0 },
|
{ KEYC_KP_ONE, "1", 0 },
|
||||||
@ -157,7 +157,7 @@ input_key(struct window_pane *wp, int key)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Then try to look this up as an xterm key, if the flag to output them
|
* Then try to look this up as an xterm key, if the flag to output them
|
||||||
* is set.
|
* is set.
|
||||||
*/
|
*/
|
||||||
|
18
input.c
18
input.c
@ -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);
|
||||||
@ -591,7 +591,7 @@ input_handle_character(u_char ch, struct input_ctx *ictx)
|
|||||||
|
|
||||||
if (ch > 0x7f && options_get_number(&wp->window->options, "utf8")) {
|
if (ch > 0x7f && options_get_number(&wp->window->options, "utf8")) {
|
||||||
if (utf8_open(&ictx->utf8data, ch)) {
|
if (utf8_open(&ictx->utf8data, ch)) {
|
||||||
log_debug2("-- utf8 size %zu: %zu: %hhu (%c)",
|
log_debug2("-- utf8 size %zu: %zu: %hhu (%c)",
|
||||||
ictx->utf8data.size, ictx->off, ch, ch);
|
ictx->utf8data.size, ictx->off, ch, ch);
|
||||||
input_state(ictx, input_state_utf8);
|
input_state(ictx, input_state_utf8);
|
||||||
return;
|
return;
|
||||||
@ -945,7 +945,7 @@ input_handle_sequence_da(struct input_ctx *ictx)
|
|||||||
return;
|
return;
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bufferevent_write(wp->event, "\033[?1;2c", (sizeof "\033[?1;2c") - 1);
|
bufferevent_write(wp->event, "\033[?1;2c", (sizeof "\033[?1;2c") - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,7 +1164,7 @@ input_handle_sequence_sm(struct input_ctx *ictx)
|
|||||||
log_debug("kcursor on");
|
log_debug("kcursor on");
|
||||||
break;
|
break;
|
||||||
case 3: /* DECCOLM */
|
case 3: /* DECCOLM */
|
||||||
screen_write_cursormove(&ictx->ctx, 0, 0);
|
screen_write_cursormove(&ictx->ctx, 0, 0);
|
||||||
screen_write_clearscreen(&ictx->ctx);
|
screen_write_clearscreen(&ictx->ctx);
|
||||||
break;
|
break;
|
||||||
case 25: /* TCEM */
|
case 25: /* TCEM */
|
||||||
@ -1240,7 +1240,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
|
|||||||
log_debug("kcursor off");
|
log_debug("kcursor off");
|
||||||
break;
|
break;
|
||||||
case 3: /* DECCOLM */
|
case 3: /* DECCOLM */
|
||||||
screen_write_cursormove(&ictx->ctx, 0, 0);
|
screen_write_cursormove(&ictx->ctx, 0, 0);
|
||||||
screen_write_clearscreen(&ictx->ctx);
|
screen_write_clearscreen(&ictx->ctx);
|
||||||
break;
|
break;
|
||||||
case 25: /* TCEM */
|
case 25: /* TCEM */
|
||||||
@ -1257,7 +1257,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
|
|||||||
sx = screen_size_x(s);
|
sx = screen_size_x(s);
|
||||||
sy = screen_size_y(s);
|
sy = screen_size_y(s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exit alternative screen mode and restore the copied
|
* Exit alternative screen mode and restore the copied
|
||||||
* grid.
|
* grid.
|
||||||
*/
|
*/
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
job.c
6
job.c
@ -80,7 +80,7 @@ job_add(struct jobs *jobs, int flags, struct client *c, const char *cmd,
|
|||||||
void (*callbackfn)(struct job *), void (*freefn)(void *), void *data)
|
void (*callbackfn)(struct job *), void (*freefn)(void *), void *data)
|
||||||
{
|
{
|
||||||
struct job *job;
|
struct job *job;
|
||||||
|
|
||||||
job = xmalloc(sizeof *job);
|
job = xmalloc(sizeof *job);
|
||||||
job->cmd = xstrdup(cmd);
|
job->cmd = xstrdup(cmd);
|
||||||
job->pid = -1;
|
job->pid = -1;
|
||||||
@ -183,7 +183,7 @@ job_run(struct job *job)
|
|||||||
|
|
||||||
if (job->event != NULL)
|
if (job->event != NULL)
|
||||||
bufferevent_free(job->event);
|
bufferevent_free(job->event);
|
||||||
job->event =
|
job->event =
|
||||||
bufferevent_new(job->fd, NULL, NULL, job_callback, job);
|
bufferevent_new(job->fd, NULL, NULL, job_callback, job);
|
||||||
bufferevent_enable(job->event, EV_READ);
|
bufferevent_enable(job->event, EV_READ);
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ job_died(struct job *job, int status)
|
|||||||
{
|
{
|
||||||
job->status = status;
|
job->status = status;
|
||||||
job->pid = -1;
|
job->pid = -1;
|
||||||
|
|
||||||
if (job->fd == -1) {
|
if (job->fd == -1) {
|
||||||
if (job->callbackfn != NULL)
|
if (job->callbackfn != NULL)
|
||||||
job->callbackfn(job);
|
job->callbackfn(job);
|
||||||
|
@ -61,11 +61,11 @@ key_bindings_add(int key, int can_repeat, struct cmd_list *cmdlist)
|
|||||||
struct key_binding *bd;
|
struct key_binding *bd;
|
||||||
|
|
||||||
key_bindings_remove(key);
|
key_bindings_remove(key);
|
||||||
|
|
||||||
bd = xmalloc(sizeof *bd);
|
bd = xmalloc(sizeof *bd);
|
||||||
bd->key = key;
|
bd->key = key;
|
||||||
SPLAY_INSERT(key_bindings, &key_bindings, bd);
|
SPLAY_INSERT(key_bindings, &key_bindings, bd);
|
||||||
|
|
||||||
bd->can_repeat = can_repeat;
|
bd->can_repeat = can_repeat;
|
||||||
bd->cmdlist = cmdlist;
|
bd->cmdlist = cmdlist;
|
||||||
}
|
}
|
||||||
@ -104,9 +104,9 @@ key_bindings_init(void)
|
|||||||
} table[] = {
|
} table[] = {
|
||||||
{ ' ', 0, &cmd_next_layout_entry },
|
{ ' ', 0, &cmd_next_layout_entry },
|
||||||
{ '!', 0, &cmd_break_pane_entry },
|
{ '!', 0, &cmd_break_pane_entry },
|
||||||
{ '"', 0, &cmd_split_window_entry },
|
{ '"', 0, &cmd_split_window_entry },
|
||||||
{ '#', 0, &cmd_list_buffers_entry },
|
{ '#', 0, &cmd_list_buffers_entry },
|
||||||
{ '%', 0, &cmd_split_window_entry },
|
{ '%', 0, &cmd_split_window_entry },
|
||||||
{ '&', 0, &cmd_confirm_before_entry },
|
{ '&', 0, &cmd_confirm_before_entry },
|
||||||
{ ',', 0, &cmd_command_prompt_entry },
|
{ ',', 0, &cmd_command_prompt_entry },
|
||||||
{ '-', 0, &cmd_delete_buffer_entry },
|
{ '-', 0, &cmd_delete_buffer_entry },
|
||||||
@ -162,7 +162,7 @@ key_bindings_init(void)
|
|||||||
{ KEYC_LEFT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry },
|
{ KEYC_LEFT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry },
|
||||||
{ KEYC_RIGHT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry },
|
{ KEYC_RIGHT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry },
|
||||||
{ KEYC_UP | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
{ KEYC_UP | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
||||||
{ KEYC_DOWN | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
{ KEYC_DOWN | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
||||||
{ KEYC_LEFT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
{ KEYC_LEFT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
||||||
{ KEYC_RIGHT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
{ KEYC_RIGHT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
|
||||||
};
|
};
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ key_string_lookup_string(const char *string)
|
|||||||
key = (u_char) ptr[0];
|
key = (u_char) ptr[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out if the single character in key is a valid ctrl
|
* Figure out if the single character in key is a valid ctrl
|
||||||
* key.
|
* key.
|
||||||
*/
|
*/
|
||||||
@ -150,7 +150,7 @@ key_string_lookup_string(const char *string)
|
|||||||
return (key - 96);
|
return (key - 96);
|
||||||
return (KEYC_NONE);
|
return (KEYC_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((string[0] == 'M' || string[0] == 'm') && string[1] == '-') {
|
if ((string[0] == 'M' || string[0] == 'm') && string[1] == '-') {
|
||||||
ptr = string + 2;
|
ptr = string + 2;
|
||||||
if (ptr[0] == '\0')
|
if (ptr[0] == '\0')
|
||||||
|
20
layout-set.c
20
layout-set.c
@ -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. */
|
||||||
|
46
layout.c
46
layout.c
@ -45,13 +45,13 @@ layout_create_cell(struct layout_cell *lcparent)
|
|||||||
lc->parent = lcparent;
|
lc->parent = lcparent;
|
||||||
|
|
||||||
TAILQ_INIT(&lc->cells);
|
TAILQ_INIT(&lc->cells);
|
||||||
|
|
||||||
lc->sx = UINT_MAX;
|
lc->sx = UINT_MAX;
|
||||||
lc->sy = UINT_MAX;
|
lc->sy = UINT_MAX;
|
||||||
|
|
||||||
lc->xoff = UINT_MAX;
|
lc->xoff = UINT_MAX;
|
||||||
lc->yoff = UINT_MAX;
|
lc->yoff = UINT_MAX;
|
||||||
|
|
||||||
lc->wp = NULL;
|
lc->wp = NULL;
|
||||||
|
|
||||||
return (lc);
|
return (lc);
|
||||||
@ -201,8 +201,8 @@ layout_fix_panes(struct window *w, u_int wsx, u_int wsy)
|
|||||||
if (sx < 1)
|
if (sx < 1)
|
||||||
sx = lc->sx;
|
sx = lc->sx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Similarly for the vertical size; the minimum vertical size
|
* Similarly for the vertical size; the minimum vertical size
|
||||||
* is two because scroll regions cannot be one line.
|
* is two because scroll regions cannot be one line.
|
||||||
*/
|
*/
|
||||||
@ -231,7 +231,7 @@ layout_resize_check(struct layout_cell *lc, enum layout_type type)
|
|||||||
available = lc->sx;
|
available = lc->sx;
|
||||||
else
|
else
|
||||||
available = lc->sy;
|
available = lc->sy;
|
||||||
|
|
||||||
if (available > PANE_MINIMUM)
|
if (available > PANE_MINIMUM)
|
||||||
available -= PANE_MINIMUM;
|
available -= PANE_MINIMUM;
|
||||||
else
|
else
|
||||||
@ -269,7 +269,7 @@ layout_resize_adjust(struct layout_cell *lc, enum layout_type type, int change)
|
|||||||
lc->sx += change;
|
lc->sx += change;
|
||||||
else
|
else
|
||||||
lc->sy += change;
|
lc->sy += change;
|
||||||
|
|
||||||
/* If this is a leaf cell, that is all that is necessary. */
|
/* If this is a leaf cell, that is all that is necessary. */
|
||||||
if (type == LAYOUT_WINDOWPANE)
|
if (type == LAYOUT_WINDOWPANE)
|
||||||
return;
|
return;
|
||||||
@ -281,8 +281,8 @@ layout_resize_adjust(struct layout_cell *lc, enum layout_type type, int change)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Child cell runs in the same direction. Adjust each child equally
|
* Child cell runs in the same direction. Adjust each child equally
|
||||||
* until no further change is possible.
|
* until no further change is possible.
|
||||||
*/
|
*/
|
||||||
while (change != 0) {
|
while (change != 0) {
|
||||||
@ -327,10 +327,10 @@ layout_resize(struct window *w, u_int sx, u_int sy)
|
|||||||
struct layout_cell *lc = w->layout_root;
|
struct layout_cell *lc = w->layout_root;
|
||||||
int xlimit, ylimit, xchange, ychange;
|
int xlimit, ylimit, xchange, ychange;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust horizontally. Do not attempt to reduce the layout lower than
|
* Adjust horizontally. Do not attempt to reduce the layout lower than
|
||||||
* the minimum (more than the amount returned by layout_resize_check).
|
* the minimum (more than the amount returned by layout_resize_check).
|
||||||
*
|
*
|
||||||
* This can mean that the window size is smaller than the total layout
|
* This can mean that the window size is smaller than the total layout
|
||||||
* size: redrawing this is handled at a higher level, but it does leave
|
* size: redrawing this is handled at a higher level, but it does leave
|
||||||
* a problem with growing the window size here: if the current size is
|
* a problem with growing the window size here: if the current size is
|
||||||
@ -366,7 +366,7 @@ layout_resize(struct window *w, u_int sx, u_int sy)
|
|||||||
}
|
}
|
||||||
if (ychange != 0)
|
if (ychange != 0)
|
||||||
layout_resize_adjust(lc, LAYOUT_TOPBOTTOM, ychange);
|
layout_resize_adjust(lc, LAYOUT_TOPBOTTOM, ychange);
|
||||||
|
|
||||||
/* Fix cell offsets. */
|
/* Fix cell offsets. */
|
||||||
layout_fix_offsets(lc);
|
layout_fix_offsets(lc);
|
||||||
layout_fix_panes(w, sx, sy);
|
layout_fix_panes(w, sx, sy);
|
||||||
@ -408,7 +408,7 @@ layout_resize_pane(struct window_pane *wp, enum layout_type type, int change)
|
|||||||
if (size == 0) /* no more change possible */
|
if (size == 0) /* no more change possible */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix cell offsets. */
|
/* Fix cell offsets. */
|
||||||
layout_fix_offsets(wp->window->layout_root);
|
layout_fix_offsets(wp->window->layout_root);
|
||||||
layout_fix_panes(wp->window, wp->window->sx, wp->window->sy);
|
layout_fix_panes(wp->window, wp->window->sx, wp->window->sy);
|
||||||
@ -423,14 +423,14 @@ layout_resize_pane_grow(
|
|||||||
|
|
||||||
/* Growing. Always add to the current cell. */
|
/* Growing. Always add to the current cell. */
|
||||||
lcadd = lc;
|
lcadd = lc;
|
||||||
|
|
||||||
/* Look towards the tail for a suitable cell for reduction. */
|
/* Look towards the tail for a suitable cell for reduction. */
|
||||||
lcremove = TAILQ_NEXT(lc, entry);
|
lcremove = TAILQ_NEXT(lc, entry);
|
||||||
while (lcremove != NULL) {
|
while (lcremove != NULL) {
|
||||||
size = layout_resize_check(lcremove, type);
|
size = layout_resize_check(lcremove, type);
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
break;
|
break;
|
||||||
lcremove = TAILQ_NEXT(lcremove, entry);
|
lcremove = TAILQ_NEXT(lcremove, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If none found, look towards the head. */
|
/* If none found, look towards the head. */
|
||||||
@ -514,7 +514,7 @@ layout_split_pane(struct window_pane *wp,
|
|||||||
default:
|
default:
|
||||||
fatalx("bad layout type");
|
fatalx("bad layout type");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc->parent != NULL && lc->parent->type == type) {
|
if (lc->parent != NULL && lc->parent->type == type) {
|
||||||
/*
|
/*
|
||||||
* If the parent exists and is of the same type as the split,
|
* If the parent exists and is of the same type as the split,
|
||||||
@ -528,7 +528,7 @@ layout_split_pane(struct window_pane *wp,
|
|||||||
/*
|
/*
|
||||||
* Otherwise create a new parent and insert it.
|
* Otherwise create a new parent and insert it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Create and insert the replacement parent. */
|
/* Create and insert the replacement parent. */
|
||||||
lcparent = layout_create_cell(lc->parent);
|
lcparent = layout_create_cell(lc->parent);
|
||||||
layout_make_node(lcparent, type);
|
layout_make_node(lcparent, type);
|
||||||
@ -537,11 +537,11 @@ layout_split_pane(struct window_pane *wp,
|
|||||||
wp->window->layout_root = lcparent;
|
wp->window->layout_root = lcparent;
|
||||||
else
|
else
|
||||||
TAILQ_REPLACE(&lc->parent->cells, lc, lcparent, entry);
|
TAILQ_REPLACE(&lc->parent->cells, lc, lcparent, entry);
|
||||||
|
|
||||||
/* Insert the old cell. */
|
/* Insert the old cell. */
|
||||||
lc->parent = lcparent;
|
lc->parent = lcparent;
|
||||||
TAILQ_INSERT_HEAD(&lcparent->cells, lc, entry);
|
TAILQ_INSERT_HEAD(&lcparent->cells, lc, entry);
|
||||||
|
|
||||||
/* Create the new child cell. */
|
/* Create the new child cell. */
|
||||||
lcnew = layout_create_cell(lcparent);
|
lcnew = layout_create_cell(lcparent);
|
||||||
TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);
|
TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);
|
||||||
@ -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;
|
||||||
@ -600,7 +600,7 @@ layout_close_pane(struct window_pane *wp)
|
|||||||
lc = wp->layout_cell;
|
lc = wp->layout_cell;
|
||||||
lcparent = lc->parent;
|
lcparent = lc->parent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no parent, this is the last pane so window close is imminent and
|
* If no parent, this is the last pane so window close is imminent and
|
||||||
* there is no need to resize anything.
|
* there is no need to resize anything.
|
||||||
*/
|
*/
|
||||||
@ -623,8 +623,8 @@ layout_close_pane(struct window_pane *wp)
|
|||||||
/* Remove this from the parent's list. */
|
/* Remove this from the parent's list. */
|
||||||
TAILQ_REMOVE(&lcparent->cells, lc, entry);
|
TAILQ_REMOVE(&lcparent->cells, lc, entry);
|
||||||
layout_free_cell(lc);
|
layout_free_cell(lc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the parent now has one cell, remove the parent from the tree and
|
* If the parent now has one cell, remove the parent from the tree and
|
||||||
* replace it by that cell.
|
* replace it by that cell.
|
||||||
*/
|
*/
|
||||||
|
2
log.c
2
log.c
@ -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);
|
||||||
|
14
mode-key.c
14
mode-key.c
@ -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" },
|
||||||
@ -61,7 +61,7 @@ struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
|
|||||||
|
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Choice keys command strings. */
|
/* Choice keys command strings. */
|
||||||
struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
|
struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
|
||||||
{ MODEKEYCHOICE_CANCEL, "cancel" },
|
{ MODEKEYCHOICE_CANCEL, "cancel" },
|
||||||
@ -195,14 +195,14 @@ const struct mode_key_entry mode_key_vi_copy[] = {
|
|||||||
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT },
|
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT },
|
||||||
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP },
|
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP },
|
||||||
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_vi_copy;
|
struct mode_key_tree mode_key_tree_vi_copy;
|
||||||
|
|
||||||
/* emacs editing keys. */
|
/* emacs editing keys. */
|
||||||
const struct mode_key_entry mode_key_emacs_edit[] = {
|
const struct mode_key_entry mode_key_emacs_edit[] = {
|
||||||
{ '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE },
|
{ '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE },
|
||||||
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT },
|
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
|
||||||
{ '\004' /* C-d */, 0, MODEKEYEDIT_DELETE },
|
{ '\004' /* C-d */, 0, MODEKEYEDIT_DELETE },
|
||||||
@ -218,7 +218,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
|
|||||||
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
|
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
|
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
|
||||||
{ '\r', 0, MODEKEYEDIT_ENTER },
|
{ '\r', 0, MODEKEYEDIT_ENTER },
|
||||||
{ 'm' | KEYC_ESCAPE, 0, MODEKEYEDIT_STARTOFLINE },
|
{ 'm' | KEYC_ESCAPE, 0, MODEKEYEDIT_STARTOFLINE },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
|
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
|
||||||
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
|
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
|
||||||
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN },
|
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN },
|
||||||
@ -287,7 +287,7 @@ const struct mode_key_entry mode_key_emacs_copy[] = {
|
|||||||
{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP },
|
{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP },
|
||||||
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_emacs_copy;
|
struct mode_key_tree mode_key_tree_emacs_copy;
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ const struct mode_key_table *
|
|||||||
mode_key_findtable(const char *name)
|
mode_key_findtable(const char *name)
|
||||||
{
|
{
|
||||||
const struct mode_key_table *mtab;
|
const struct mode_key_table *mtab;
|
||||||
|
|
||||||
for (mtab = mode_key_tables; mtab->name != NULL; mtab++) {
|
for (mtab = mode_key_tables; mtab->name != NULL; mtab++) {
|
||||||
if (strcasecmp(name, mtab->name) == 0)
|
if (strcasecmp(name, mtab->name) == 0)
|
||||||
return (mtab);
|
return (mtab);
|
||||||
|
6
names.c
6
names.c
@ -59,7 +59,7 @@ window_name_callback(unused int fd, unused short events, void *data)
|
|||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
wname = default_window_name(w);
|
wname = default_window_name(w);
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
* If tmux is using the default command, it will be a login
|
* If tmux is using the default command, it will be a login
|
||||||
* shell and argv[0] may have a - prefix. Remove this if it is
|
* shell and argv[0] may have a - prefix. Remove this if it is
|
||||||
* present. Ick.
|
* present. Ick.
|
||||||
@ -71,13 +71,13 @@ window_name_callback(unused int fd, unused short events, void *data)
|
|||||||
wname = parse_window_name(name);
|
wname = parse_window_name(name);
|
||||||
xfree(name);
|
xfree(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->active->fd == -1) {
|
if (w->active->fd == -1) {
|
||||||
xasprintf(&name, "%s[dead]", wname);
|
xasprintf(&name, "%s[dead]", wname);
|
||||||
xfree(wname);
|
xfree(wname);
|
||||||
wname = name;
|
wname = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(wname, w->name) == 0)
|
if (strcmp(wname, w->name) == 0)
|
||||||
xfree(wname);
|
xfree(wname);
|
||||||
else {
|
else {
|
||||||
|
4
paste.c
4
paste.c
@ -106,7 +106,7 @@ paste_free_index(struct paste_stack *ps, u_int idx)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add an item onto the top of the stack, freeing the bottom if at limit. Note
|
* Add an item onto the top of the stack, freeing the bottom if at limit. Note
|
||||||
* that the caller is responsible for allocating data.
|
* that the caller is responsible for allocating data.
|
||||||
*/
|
*/
|
||||||
@ -133,7 +133,7 @@ paste_add(struct paste_stack *ps, char *data, size_t size, u_int limit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace an item on the stack. Note that the caller is responsible for
|
* Replace an item on the stack. Note that the caller is responsible for
|
||||||
* allocating data.
|
* allocating data.
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Top/bottom borders. */
|
/* Top/bottom borders. */
|
||||||
if ((wp->xoff == 0 || px >= wp->xoff - 1) &&
|
if ((wp->xoff == 0 || px >= wp->xoff - 1) &&
|
||||||
px <= wp->xoff + wp->sx) {
|
px <= wp->xoff + wp->sx) {
|
||||||
if (wp->yoff != 0 && py == wp->yoff - 1)
|
if (wp->yoff != 0 && py == wp->yoff - 1)
|
||||||
return (1);
|
return (1);
|
||||||
@ -105,7 +105,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py)
|
|||||||
if (!screen_redraw_cell_border(c, px, py))
|
if (!screen_redraw_cell_border(c, px, py))
|
||||||
return (CELL_INSIDE);
|
return (CELL_INSIDE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct a bitmask of whether the cells to the left (bit
|
* Construct a bitmask of whether the cells to the left (bit
|
||||||
* 4), right, top, and bottom (bit 1) of this cell are borders.
|
* 4), right, top, and bottom (bit 1) of this cell are borders.
|
||||||
*/
|
*/
|
||||||
@ -119,7 +119,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py)
|
|||||||
if (py <= w->sy && screen_redraw_cell_border(c, px, py + 1))
|
if (py <= w->sy && screen_redraw_cell_border(c, px, py + 1))
|
||||||
borders |= 1;
|
borders |= 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out what kind of border this cell is. Only one bit
|
* Figure out what kind of border this cell is. Only one bit
|
||||||
* set doesn't make sense (can't have a border cell with no
|
* set doesn't make sense (can't have a border cell with no
|
||||||
* others connected).
|
* others connected).
|
||||||
@ -263,7 +263,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
|
|||||||
tty_puts(tty, buf);
|
tty_puts(tty, buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
px -= len * 3;
|
px -= len * 3;
|
||||||
py -= 2;
|
py -= 2;
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
|
|||||||
if (*ptr < '0' || *ptr > '9')
|
if (*ptr < '0' || *ptr > '9')
|
||||||
continue;
|
continue;
|
||||||
idx = *ptr - '0';
|
idx = *ptr - '0';
|
||||||
|
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
for (i = px; i < px + 5; i++) {
|
for (i = px; i < px + 5; i++) {
|
||||||
tty_cursor(tty, xoff + i, yoff + py + j);
|
tty_cursor(tty, xoff + i, yoff + py + j);
|
||||||
|
@ -183,7 +183,7 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
size += utf8data.width;
|
size += utf8data.width;
|
||||||
|
|
||||||
gc->flags |= GRID_FLAG_UTF8;
|
gc->flags |= GRID_FLAG_UTF8;
|
||||||
screen_write_cell(ctx, gc, &utf8data);
|
screen_write_cell(ctx, gc, &utf8data);
|
||||||
gc->flags &= ~GRID_FLAG_UTF8;
|
gc->flags &= ~GRID_FLAG_UTF8;
|
||||||
@ -376,7 +376,7 @@ screen_write_copy(struct screen_write_ctx *ctx,
|
|||||||
bx = gl->cellsize;
|
bx = gl->cellsize;
|
||||||
else
|
else
|
||||||
bx = px + nx;
|
bx = px + nx;
|
||||||
|
|
||||||
for (xx = ax; xx < bx; xx++) {
|
for (xx = ax; xx < bx; xx++) {
|
||||||
if (xx >= gl->cellsize)
|
if (xx >= gl->cellsize)
|
||||||
gc = &grid_default_cell;
|
gc = &grid_default_cell;
|
||||||
@ -646,7 +646,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
ny = s->rlower + 1 - s->cy;
|
ny = s->rlower + 1 - s->cy;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0);
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
@ -682,7 +682,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
tty_write(tty_cmd_deleteline, &ttyctx);
|
tty_write(tty_cmd_deleteline, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ny > s->rlower + 1 - s->cy)
|
if (ny > s->rlower + 1 - s->cy)
|
||||||
ny = s->rlower + 1 - s->cy;
|
ny = s->rlower + 1 - s->cy;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
@ -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). */
|
||||||
@ -988,7 +988,7 @@ screen_write_cell(struct screen_write_ctx *ctx,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the width is zero, combine onto the previous character, if
|
* If the width is zero, combine onto the previous character, if
|
||||||
* there is space.
|
* there is space.
|
||||||
*/
|
*/
|
||||||
if (width == 0) {
|
if (width == 0) {
|
||||||
if (screen_write_combine(ctx, utf8data) == 0) {
|
if (screen_write_combine(ctx, utf8data) == 0) {
|
||||||
|
8
screen.c
8
screen.c
@ -51,7 +51,7 @@ screen_reinit(struct screen *s)
|
|||||||
s->rlower = screen_size_y(s) - 1;
|
s->rlower = screen_size_y(s) - 1;
|
||||||
|
|
||||||
s->mode = MODE_CURSOR;
|
s->mode = MODE_CURSOR;
|
||||||
|
|
||||||
screen_reset_tabs(s);
|
screen_reset_tabs(s);
|
||||||
|
|
||||||
grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy);
|
grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy);
|
||||||
@ -152,12 +152,12 @@ screen_resize_y(struct screen *s, u_int sy)
|
|||||||
fatalx("zero size");
|
fatalx("zero size");
|
||||||
oldy = screen_size_y(s);
|
oldy = screen_size_y(s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When resizing:
|
* When resizing:
|
||||||
*
|
*
|
||||||
* If the height is decreasing, delete lines from the bottom until
|
* If the height is decreasing, delete lines from the bottom until
|
||||||
* hitting the cursor, then push lines from the top into the history.
|
* hitting the cursor, then push lines from the top into the history.
|
||||||
*
|
*
|
||||||
* When increasing, pull as many lines as possible from the history to
|
* When increasing, pull as many lines as possible from the history to
|
||||||
* the top, then fill the remaining with blanks at the bottom.
|
* the top, then fill the remaining with blanks at the bottom.
|
||||||
*/
|
*/
|
||||||
@ -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(
|
||||||
|
@ -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 *, ...);
|
||||||
@ -62,7 +62,7 @@ server_client_create(int fd)
|
|||||||
c->references = 0;
|
c->references = 0;
|
||||||
imsg_init(&c->ibuf, fd);
|
imsg_init(&c->ibuf, fd);
|
||||||
server_update_event(c);
|
server_update_event(c);
|
||||||
|
|
||||||
if (gettimeofday(&c->creation_time, NULL) != 0)
|
if (gettimeofday(&c->creation_time, NULL) != 0)
|
||||||
fatal("gettimeofday failed");
|
fatal("gettimeofday failed");
|
||||||
memcpy(&c->activity_time, &c->creation_time, sizeof c->activity_time);
|
memcpy(&c->activity_time, &c->creation_time, sizeof c->activity_time);
|
||||||
@ -189,7 +189,7 @@ server_client_callback(int fd, short events, void *data)
|
|||||||
goto client_lost;
|
goto client_lost;
|
||||||
}
|
}
|
||||||
|
|
||||||
server_update_event(c);
|
server_update_event(c);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client_lost:
|
client_lost:
|
||||||
@ -270,7 +270,7 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
|
|||||||
oo = &c->session->options;
|
oo = &c->session->options;
|
||||||
|
|
||||||
/* Special case: number keys jump to pane in identify mode. */
|
/* Special case: number keys jump to pane in identify mode. */
|
||||||
if (c->flags & CLIENT_IDENTIFY && key >= '0' && key <= '9') {
|
if (c->flags & CLIENT_IDENTIFY && key >= '0' && key <= '9') {
|
||||||
wp = window_pane_at_index(w, key - '0');
|
wp = window_pane_at_index(w, key - '0');
|
||||||
if (wp != NULL && window_pane_visible(wp))
|
if (wp != NULL && window_pane_visible(wp))
|
||||||
window_set_active_pane(w, wp);
|
window_set_active_pane(w, wp);
|
||||||
@ -348,7 +348,7 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
|
|||||||
xtimeout = options_get_number(&c->session->options, "repeat-time");
|
xtimeout = options_get_number(&c->session->options, "repeat-time");
|
||||||
if (xtimeout != 0 && bd->can_repeat) {
|
if (xtimeout != 0 && bd->can_repeat) {
|
||||||
c->flags |= CLIENT_PREFIX|CLIENT_REPEAT;
|
c->flags |= CLIENT_PREFIX|CLIENT_REPEAT;
|
||||||
|
|
||||||
tv.tv_sec = xtimeout / 1000;
|
tv.tv_sec = xtimeout / 1000;
|
||||||
tv.tv_usec = (xtimeout % 1000) * 1000L;
|
tv.tv_usec = (xtimeout % 1000) * 1000L;
|
||||||
evtimer_del(&c->repeat_timer);
|
evtimer_del(&c->repeat_timer);
|
||||||
@ -489,7 +489,7 @@ server_client_set_title(struct client *c)
|
|||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
template = options_get_string(&s->options, "set-titles-string");
|
template = options_get_string(&s->options, "set-titles-string");
|
||||||
|
|
||||||
title = status_replace(c, NULL, template, time(NULL), 1);
|
title = status_replace(c, NULL, template, time(NULL), 1);
|
||||||
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
||||||
if (c->title != NULL)
|
if (c->title != NULL)
|
||||||
@ -743,14 +743,14 @@ server_client_msg_shell(struct client *c)
|
|||||||
{
|
{
|
||||||
struct msg_shell_data data;
|
struct msg_shell_data data;
|
||||||
const char *shell;
|
const char *shell;
|
||||||
|
|
||||||
shell = options_get_string(&global_s_options, "default-shell");
|
shell = options_get_string(&global_s_options, "default-shell");
|
||||||
|
|
||||||
if (*shell == '\0' || areshell(shell))
|
if (*shell == '\0' || areshell(shell))
|
||||||
shell = _PATH_BSHELL;
|
shell = _PATH_BSHELL;
|
||||||
if (strlcpy(data.shell, shell, sizeof data.shell) >= sizeof data.shell)
|
if (strlcpy(data.shell, shell, sizeof data.shell) >= sizeof data.shell)
|
||||||
strlcpy(data.shell, _PATH_BSHELL, sizeof data.shell);
|
strlcpy(data.shell, _PATH_BSHELL, sizeof data.shell);
|
||||||
|
|
||||||
server_write_client(c, MSG_SHELL, &data, sizeof data);
|
server_write_client(c, MSG_SHELL, &data, sizeof data);
|
||||||
c->flags |= CLIENT_BAD; /* it will die after exec */
|
c->flags |= CLIENT_BAD; /* it will die after exec */
|
||||||
}
|
}
|
||||||
|
16
server-fn.c
16
server-fn.c
@ -61,7 +61,7 @@ server_write_client(
|
|||||||
return;
|
return;
|
||||||
log_debug("writing %d to client %d", type, c->ibuf.fd);
|
log_debug("writing %d to client %d", type, c->ibuf.fd);
|
||||||
imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len);
|
imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len);
|
||||||
server_update_event(c);
|
server_update_event(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -208,7 +208,7 @@ server_lock_session(struct session *s)
|
|||||||
if (c == NULL || c->session == NULL || c->session != s)
|
if (c == NULL || c->session == NULL || c->session != s)
|
||||||
continue;
|
continue;
|
||||||
server_lock_client(c);
|
server_lock_client(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -225,7 +225,7 @@ server_lock_client(struct client *c)
|
|||||||
cmdlen = strlcpy(lockdata.cmd, cmd, sizeof lockdata.cmd);
|
cmdlen = strlcpy(lockdata.cmd, cmd, sizeof lockdata.cmd);
|
||||||
if (cmdlen >= sizeof lockdata.cmd)
|
if (cmdlen >= sizeof lockdata.cmd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tty_stop_tty(&c->tty);
|
tty_stop_tty(&c->tty);
|
||||||
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_SMCUP));
|
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_SMCUP));
|
||||||
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_CLEAR));
|
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_CLEAR));
|
||||||
@ -240,14 +240,14 @@ server_kill_window(struct window *w)
|
|||||||
struct session *s;
|
struct session *s;
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
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);
|
||||||
if (s == NULL || !session_has(s, w))
|
if (s == NULL || !session_has(s, w))
|
||||||
continue;
|
continue;
|
||||||
if ((wl = winlink_find_by_window(&s->windows, w)) == NULL)
|
if ((wl = winlink_find_by_window(&s->windows, w)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (session_detach(s, wl))
|
if (session_detach(s, wl))
|
||||||
server_destroy_session_group(s);
|
server_destroy_session_group(s);
|
||||||
else {
|
else {
|
||||||
@ -357,7 +357,7 @@ server_destroy_session(struct session *s)
|
|||||||
{
|
{
|
||||||
struct client *c;
|
struct client *c;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
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)
|
||||||
@ -376,7 +376,7 @@ server_set_identify(struct client *c)
|
|||||||
delay = options_get_number(&c->session->options, "display-panes-time");
|
delay = options_get_number(&c->session->options, "display-panes-time");
|
||||||
tv.tv_sec = delay / 1000;
|
tv.tv_sec = delay / 1000;
|
||||||
tv.tv_usec = (delay % 1000) * 1000L;
|
tv.tv_usec = (delay % 1000) * 1000L;
|
||||||
|
|
||||||
evtimer_del(&c->identify_timer);
|
evtimer_del(&c->identify_timer);
|
||||||
evtimer_set(&c->identify_timer, server_callback_identify, c);
|
evtimer_set(&c->identify_timer, server_callback_identify, c);
|
||||||
evtimer_add(&c->identify_timer, &tv);
|
evtimer_add(&c->identify_timer, &tv);
|
||||||
@ -417,5 +417,5 @@ server_update_event(struct client *c)
|
|||||||
events |= EV_WRITE;
|
events |= EV_WRITE;
|
||||||
event_del(&c->event);
|
event_del(&c->event);
|
||||||
event_set(&c->event, c->ibuf.fd, events, server_client_callback, c);
|
event_set(&c->event, c->ibuf.fd, events, server_client_callback, c);
|
||||||
event_add(&c->event, NULL);
|
event_add(&c->event, NULL);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ server_window_loop(void)
|
|||||||
s = ARRAY_ITEM(&sessions, j);
|
s = ARRAY_ITEM(&sessions, j);
|
||||||
if (s == NULL || !session_has(s, w))
|
if (s == NULL || !session_has(s, w))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (server_window_check_bell(s, w) ||
|
if (server_window_check_bell(s, w) ||
|
||||||
server_window_check_activity(s, w))
|
server_window_check_activity(s, w))
|
||||||
server_status_session(s);
|
server_status_session(s);
|
||||||
@ -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)
|
||||||
@ -193,7 +193,7 @@ server_window_check_content(
|
|||||||
struct client *c;
|
struct client *c;
|
||||||
u_int i;
|
u_int i;
|
||||||
char *found, *ptr;
|
char *found, *ptr;
|
||||||
|
|
||||||
if (!(w->flags & WINDOW_ACTIVITY)) /* activity for new content */
|
if (!(w->flags & WINDOW_ACTIVITY)) /* activity for new content */
|
||||||
return (0);
|
return (0);
|
||||||
if (s->curw->window == w)
|
if (s->curw->window == w)
|
||||||
@ -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)
|
||||||
|
6
server.c
6
server.c
@ -216,7 +216,7 @@ server_loop(void)
|
|||||||
|
|
||||||
key_bindings_clean();
|
key_bindings_clean();
|
||||||
server_clean_dead();
|
server_clean_dead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the server should be shutting down (no more clients or windows). */
|
/* Check if the server should be shutting down (no more clients or windows). */
|
||||||
@ -454,7 +454,7 @@ server_child_exited(pid_t pid, int status)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SLIST_FOREACH(job, &all_jobs, lentry) {
|
SLIST_FOREACH(job, &all_jobs, lentry) {
|
||||||
if (pid == job->pid) {
|
if (pid == job->pid) {
|
||||||
@ -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;
|
||||||
|
@ -165,7 +165,7 @@ session_create(const char *name, const char *cmd, const char *cwd,
|
|||||||
s->name = xstrdup(name);
|
s->name = xstrdup(name);
|
||||||
else
|
else
|
||||||
xasprintf(&s->name, "%u", i);
|
xasprintf(&s->name, "%u", i);
|
||||||
|
|
||||||
if (cmd != NULL) {
|
if (cmd != NULL) {
|
||||||
if (session_new(s, NULL, cmd, cwd, idx, cause) == NULL) {
|
if (session_new(s, NULL, cmd, cwd, idx, cause) == NULL) {
|
||||||
session_destroy(s);
|
session_destroy(s);
|
||||||
@ -208,7 +208,7 @@ session_destroy(struct session *s)
|
|||||||
winlink_remove(&s->windows, RB_ROOT(&s->windows));
|
winlink_remove(&s->windows, RB_ROOT(&s->windows));
|
||||||
|
|
||||||
xfree(s->name);
|
xfree(s->name);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(&dead_sessions); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&dead_sessions); i++) {
|
||||||
if (ARRAY_ITEM(&dead_sessions, i) == NULL) {
|
if (ARRAY_ITEM(&dead_sessions, i) == NULL) {
|
||||||
ARRAY_SET(&dead_sessions, i, s);
|
ARRAY_SET(&dead_sessions, i, s);
|
||||||
@ -233,7 +233,7 @@ session_index(struct session *s, u_int *i)
|
|||||||
|
|
||||||
/* Create a new window on a session. */
|
/* Create a new window on a session. */
|
||||||
struct winlink *
|
struct winlink *
|
||||||
session_new(struct session *s,
|
session_new(struct session *s,
|
||||||
const char *name, const char *cmd, const char *cwd, int idx, char **cause)
|
const char *name, const char *cmd, const char *cwd, int idx, char **cause)
|
||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
@ -463,7 +463,7 @@ session_group_index(struct session_group *sg)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a session to the session group containing target, creating it if
|
* Add a session to the session group containing target, creating it if
|
||||||
* necessary.
|
* necessary.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
session_group_add(struct session *target, struct session *s)
|
session_group_add(struct session *target, struct session *s)
|
||||||
|
40
status.c
40
status.c
@ -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)
|
||||||
@ -179,7 +179,7 @@ status_redraw(struct client *c)
|
|||||||
xfree(wl->status_text);
|
xfree(wl->status_text);
|
||||||
memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell);
|
memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell);
|
||||||
wl->status_text = status_print(c, wl, t, &wl->status_cell);
|
wl->status_text = status_print(c, wl, t, &wl->status_cell);
|
||||||
wl->status_width =
|
wl->status_width =
|
||||||
screen_write_cstrlen(utf8flag, "%s", wl->status_text);
|
screen_write_cstrlen(utf8flag, "%s", wl->status_text);
|
||||||
|
|
||||||
if (wl == s->curw)
|
if (wl == s->curw)
|
||||||
@ -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, ' ');
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ status_redraw(struct client *c)
|
|||||||
larrow = 1;
|
larrow = 1;
|
||||||
wlavailable--;
|
wlavailable--;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlstart = wloffset + wlsize - wlavailable;
|
wlstart = wloffset + wlsize - wlavailable;
|
||||||
if (wlavailable > 0 && wlwidth > wlstart + wlavailable + 1) {
|
if (wlavailable > 0 && wlwidth > wlstart + wlavailable + 1) {
|
||||||
rarrow = 1;
|
rarrow = 1;
|
||||||
@ -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);
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ status_replace1(struct client *c,struct winlink *wl,
|
|||||||
limit = strtol(*iptr, &endptr, 10);
|
limit = strtol(*iptr, &endptr, 10);
|
||||||
if ((limit == 0 && errno != EINVAL) ||
|
if ((limit == 0 && errno != EINVAL) ||
|
||||||
(limit == LONG_MIN && errno != ERANGE) ||
|
(limit == LONG_MIN && errno != ERANGE) ||
|
||||||
(limit == LONG_MAX && errno != ERANGE) ||
|
(limit == LONG_MAX && errno != ERANGE) ||
|
||||||
limit != 0)
|
limit != 0)
|
||||||
*iptr = endptr;
|
*iptr = endptr;
|
||||||
if (limit <= 0)
|
if (limit <= 0)
|
||||||
@ -412,7 +412,7 @@ status_replace1(struct client *c,struct winlink *wl,
|
|||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
goto do_replace;
|
goto do_replace;
|
||||||
case '[':
|
case '[':
|
||||||
/*
|
/*
|
||||||
* Embedded style, handled at display time. Leave present and
|
* Embedded style, handled at display time. Leave present and
|
||||||
* skip input until ].
|
* skip input until ].
|
||||||
*/
|
*/
|
||||||
@ -424,7 +424,7 @@ status_replace1(struct client *c,struct winlink *wl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do_replace:
|
do_replace:
|
||||||
ptrlen = strlen(ptr);
|
ptrlen = strlen(ptr);
|
||||||
if ((size_t) limit < ptrlen)
|
if ((size_t) limit < ptrlen)
|
||||||
@ -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)
|
||||||
|
4
tmux.1
4
tmux.1
@ -1252,7 +1252,7 @@ options - it is not possible to unset a global option.
|
|||||||
With
|
With
|
||||||
.Fl w ,
|
.Fl w ,
|
||||||
this command is equivalent to
|
this command is equivalent to
|
||||||
.Ic set-window-option
|
.Ic set-window-option
|
||||||
with
|
with
|
||||||
.Ar target-window .
|
.Ar target-window .
|
||||||
.Pp
|
.Pp
|
||||||
@ -1850,7 +1850,7 @@ or the global session options with
|
|||||||
If
|
If
|
||||||
.Fl w
|
.Fl w
|
||||||
is used, this command is equivalent to
|
is used, this command is equivalent to
|
||||||
.Ic show-window-options
|
.Ic show-window-options
|
||||||
with
|
with
|
||||||
.Ar target-window .
|
.Ar target-window .
|
||||||
.It Xo Ic show-window-options
|
.It Xo Ic show-window-options
|
||||||
|
22
tmux.c
22
tmux.c
@ -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 {
|
||||||
@ -432,7 +432,7 @@ main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label == NULL)
|
if (label == NULL)
|
||||||
label = xstrdup("default");
|
label = xstrdup("default");
|
||||||
if (path == NULL && (path = makesockpath(label)) == NULL) {
|
if (path == NULL && (path = makesockpath(label)) == NULL) {
|
||||||
@ -447,14 +447,14 @@ main(int argc, char **argv)
|
|||||||
len = 0;
|
len = 0;
|
||||||
} else {
|
} else {
|
||||||
fill_session(&cmddata);
|
fill_session(&cmddata);
|
||||||
|
|
||||||
cmddata.argc = argc;
|
cmddata.argc = argc;
|
||||||
if (cmd_pack_argv(
|
if (cmd_pack_argv(
|
||||||
argc, argv, cmddata.argv, sizeof cmddata.argv) != 0) {
|
argc, argv, cmddata.argv, sizeof cmddata.argv) != 0) {
|
||||||
log_warnx("command too long");
|
log_warnx("command too long");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = MSG_COMMAND;
|
msg = MSG_COMMAND;
|
||||||
buf = &cmddata;
|
buf = &cmddata;
|
||||||
len = sizeof cmddata;
|
len = sizeof cmddata;
|
||||||
@ -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();
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ main_set_signals(void)
|
|||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
|
|
||||||
signal_set(&main_ev_sigterm, SIGTERM, main_signal, NULL);
|
signal_set(&main_ev_sigterm, SIGTERM, main_signal, NULL);
|
||||||
signal_add(&main_ev_sigterm, NULL);
|
signal_add(&main_ev_sigterm, NULL);
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ main_clear_signals(void)
|
|||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
|
|
||||||
event_del(&main_ev_sigterm);
|
event_del(&main_ev_sigterm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ main_callback(unused int fd, short events, void *data)
|
|||||||
|
|
||||||
if (events & EV_READ)
|
if (events & EV_READ)
|
||||||
main_dispatch(shellcmd);
|
main_dispatch(shellcmd);
|
||||||
|
|
||||||
if (events & EV_WRITE) {
|
if (events & EV_WRITE) {
|
||||||
if (msgbuf_write(&main_ibuf->w) < 0)
|
if (msgbuf_write(&main_ibuf->w) < 0)
|
||||||
fatalx("msgbuf_write failed");
|
fatalx("msgbuf_write failed");
|
||||||
|
128
tmux.h
128
tmux.h
@ -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. */
|
||||||
@ -438,7 +438,7 @@ enum mode_key_cmd {
|
|||||||
MODEKEYEDIT_SWITCHMODE,
|
MODEKEYEDIT_SWITCHMODE,
|
||||||
MODEKEYEDIT_SWITCHMODEAPPEND,
|
MODEKEYEDIT_SWITCHMODEAPPEND,
|
||||||
MODEKEYEDIT_TRANSPOSECHARS,
|
MODEKEYEDIT_TRANSPOSECHARS,
|
||||||
|
|
||||||
/* Menu (choice) keys. */
|
/* Menu (choice) keys. */
|
||||||
MODEKEYCHOICE_CANCEL,
|
MODEKEYCHOICE_CANCEL,
|
||||||
MODEKEYCHOICE_CHOOSE,
|
MODEKEYCHOICE_CHOOSE,
|
||||||
@ -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);
|
||||||
|
18
tty-keys.c
18
tty-keys.c
@ -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(
|
||||||
@ -50,7 +50,7 @@ struct tty_key_ent {
|
|||||||
#define TTYKEY_RAW 0x1
|
#define TTYKEY_RAW 0x1
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default key tables. Those flagged with TTYKEY_RAW are inserted directly,
|
* Default key tables. Those flagged with TTYKEY_RAW are inserted directly,
|
||||||
* otherwise they are looked up in terminfo(5).
|
* otherwise they are looked up in terminfo(5).
|
||||||
*/
|
*/
|
||||||
@ -319,7 +319,7 @@ tty_keys_add1(struct tty_key **tkp, const char *s, int key)
|
|||||||
|
|
||||||
/* Use the child tree for the next character. */
|
/* Use the child tree for the next character. */
|
||||||
tkp = &tk->next;
|
tkp = &tk->next;
|
||||||
} else {
|
} else {
|
||||||
if (*s < tk->ch)
|
if (*s < tk->ch)
|
||||||
tkp = &tk->left;
|
tkp = &tk->left;
|
||||||
else if (*s > tk->ch)
|
else if (*s > tk->ch)
|
||||||
@ -374,7 +374,7 @@ tty_keys_free1(struct tty_key *tk)
|
|||||||
if (tk->right != NULL)
|
if (tk->right != NULL)
|
||||||
tty_keys_free1(tk->right);
|
tty_keys_free1(tk->right);
|
||||||
xfree(tk);
|
xfree(tk);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup a key in the tree. */
|
/* Lookup a key in the tree. */
|
||||||
@ -523,11 +523,11 @@ start_timer:
|
|||||||
/* Start the timer and wait for expiry or more data. */
|
/* Start the timer and wait for expiry or more data. */
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = ESCAPE_PERIOD * 1000L;
|
tv.tv_usec = ESCAPE_PERIOD * 1000L;
|
||||||
|
|
||||||
evtimer_del(&tty->key_timer);
|
evtimer_del(&tty->key_timer);
|
||||||
evtimer_set(&tty->key_timer, tty_keys_callback, tty);
|
evtimer_set(&tty->key_timer, tty_keys_callback, tty);
|
||||||
evtimer_add(&tty->key_timer, &tv);
|
evtimer_add(&tty->key_timer, &tv);
|
||||||
|
|
||||||
tty->flags |= TTY_ESCAPE;
|
tty->flags |= TTY_ESCAPE;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -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);
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ tty_keys_callback(unused int fd, unused short events, void *data)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle mouse key input. Returns 0 for success, -1 for failure, 1 for partial
|
* Handle mouse key input. Returns 0 for success, -1 for failure, 1 for partial
|
||||||
* (probably a mouse sequence but need more data).
|
* (probably a mouse sequence but need more data).
|
||||||
*/
|
*/
|
||||||
@ -593,7 +593,7 @@ tty_keys_mouse(const char *buf, size_t len, size_t *size, struct mouse_event *m)
|
|||||||
return (-1);
|
return (-1);
|
||||||
if (len == 2)
|
if (len == 2)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
if (buf[2] != 'M')
|
if (buf[2] != 'M')
|
||||||
return (-1);
|
return (-1);
|
||||||
if (len == 3)
|
if (len == 3)
|
||||||
|
10
tty-term.c
10
tty-term.c
@ -227,7 +227,7 @@ tty_term_override(struct tty_term *term, const char *overrides)
|
|||||||
termnext = s;
|
termnext = s;
|
||||||
while ((termstr = strsep(&termnext, ",")) != NULL) {
|
while ((termstr = strsep(&termnext, ",")) != NULL) {
|
||||||
entnext = termstr;
|
entnext = termstr;
|
||||||
|
|
||||||
entstr = strsep(&entnext, ":");
|
entstr = strsep(&entnext, ":");
|
||||||
if (entstr == NULL || entnext == NULL)
|
if (entstr == NULL || entnext == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -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");
|
||||||
|
80
tty.c
80
tty.c
@ -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)
|
||||||
@ -502,7 +502,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
|||||||
if (screen_check_selection(s, i, py)) {
|
if (screen_check_selection(s, i, py)) {
|
||||||
memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
|
memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
|
||||||
tmpgc.data = gc->data;
|
tmpgc.data = gc->data;
|
||||||
tmpgc.flags = gc->flags &
|
tmpgc.flags = gc->flags &
|
||||||
~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
tmpgc.flags |= s->sel.cell.flags &
|
tmpgc.flags |= s->sel.cell.flags &
|
||||||
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
@ -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,12 +573,12 @@ 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))
|
||||||
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
|
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
|
||||||
else if (tty_term_has(tty->term, TTYC_SMIR) &&
|
else if (tty_term_has(tty->term, TTYC_SMIR) &&
|
||||||
tty_term_has(tty->term, TTYC_RMIR)) {
|
tty_term_has(tty->term, TTYC_RMIR)) {
|
||||||
tty_putcode(tty, TTYC_SMIR);
|
tty_putcode(tty, TTYC_SMIR);
|
||||||
for (i = 0; i < ctx->num; i++)
|
for (i = 0; i < ctx->num; i++)
|
||||||
@ -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,11 +613,11 @@ 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);
|
||||||
return;
|
return;
|
||||||
@ -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);
|
||||||
@ -727,23 +727,23 @@ tty_cmd_reverseindex(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->orupper);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
|
||||||
|
|
||||||
tty_putcode(tty, TTYC_RI);
|
tty_putcode(tty, TTYC_RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@ -758,17 +758,17 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
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_putc(tty, '\n');
|
tty_putc(tty, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -921,7 +921,7 @@ tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
* Cannot rely on not being a partial character, so just redraw the
|
* Cannot rely on not being a partial character, so just redraw the
|
||||||
* whole line.
|
* whole line.
|
||||||
*/
|
*/
|
||||||
tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
|
tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -1028,7 +1028,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
|
|||||||
struct tty_term *term = tty->term;
|
struct tty_term *term = tty->term;
|
||||||
u_int thisx, thisy;
|
u_int thisx, thisy;
|
||||||
int change;
|
int change;
|
||||||
|
|
||||||
if (cx > tty->sx - 1)
|
if (cx > tty->sx - 1)
|
||||||
cx = tty->sx - 1;
|
cx = tty->sx - 1;
|
||||||
|
|
||||||
@ -1103,7 +1103,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* One above. */
|
/* One above. */
|
||||||
if (thisy != tty->rupper &&
|
if (thisy != tty->rupper &&
|
||||||
cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) {
|
cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) {
|
||||||
tty_putcode(tty, TTYC_CUU1);
|
tty_putcode(tty, TTYC_CUU1);
|
||||||
goto out;
|
goto out;
|
||||||
@ -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) ||
|
||||||
@ -1265,7 +1265,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, u_char *attr)
|
|||||||
}
|
}
|
||||||
if (bg_default &&
|
if (bg_default &&
|
||||||
bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) {
|
bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) {
|
||||||
if (have_ax)
|
if (have_ax)
|
||||||
tty_puts(tty, "\033[49m");
|
tty_puts(tty, "\033[49m");
|
||||||
else if (tc->bg != 0)
|
else if (tc->bg != 0)
|
||||||
tty_putcode1(tty, TTYC_SETAB, 0);
|
tty_putcode1(tty, TTYC_SETAB, 0);
|
||||||
@ -1315,7 +1315,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
|
|||||||
/* Otherwise set the foreground colour. */
|
/* Otherwise set the foreground colour. */
|
||||||
tty_putcode1(tty, TTYC_SETAF, fg);
|
tty_putcode1(tty, TTYC_SETAF, fg);
|
||||||
|
|
||||||
save_fg:
|
save_fg:
|
||||||
/* Save the new values in the terminal current cell. */
|
/* Save the new values in the terminal current cell. */
|
||||||
tc->fg = fg;
|
tc->fg = fg;
|
||||||
tc->flags &= ~GRID_FLAG_FG256;
|
tc->flags &= ~GRID_FLAG_FG256;
|
||||||
|
@ -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);
|
||||||
@ -268,7 +268,7 @@ window_choose_key(struct window_pane *wp, unused struct client *c, int key)
|
|||||||
if (idx < 0 || (u_int) idx >= ARRAY_LENGTH(&data->list))
|
if (idx < 0 || (u_int) idx >= ARRAY_LENGTH(&data->list))
|
||||||
break;
|
break;
|
||||||
data->selected = idx;
|
data->selected = idx;
|
||||||
|
|
||||||
item = &ARRAY_ITEM(&data->list, data->selected);
|
item = &ARRAY_ITEM(&data->list, data->selected);
|
||||||
data->callbackfn(data->data, item->idx);
|
data->callbackfn(data->data, item->idx);
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
@ -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)
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(
|
||||||
@ -195,7 +195,7 @@ window_copy_resize(struct window_pane *wp, u_int sx, u_int sy)
|
|||||||
struct screen_write_ctx ctx;
|
struct screen_write_ctx ctx;
|
||||||
|
|
||||||
screen_resize(s, sx, sy);
|
screen_resize(s, sx, sy);
|
||||||
|
|
||||||
if (data->cy > sy - 1)
|
if (data->cy > sy - 1)
|
||||||
data->cy = sy - 1;
|
data->cy = sy - 1;
|
||||||
if (data->cx > sx)
|
if (data->cx > sx)
|
||||||
@ -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:
|
||||||
@ -422,7 +422,7 @@ window_copy_key_input(struct window_pane *wp, int key)
|
|||||||
if (key < 32 || key > 126)
|
if (key < 32 || key > 126)
|
||||||
break;
|
break;
|
||||||
inputlen = strlen(data->inputstr) + 2;
|
inputlen = strlen(data->inputstr) + 2;
|
||||||
|
|
||||||
data->inputstr = xrealloc(data->inputstr, 1, inputlen);
|
data->inputstr = xrealloc(data->inputstr, 1, inputlen);
|
||||||
data->inputstr[inputlen - 2] = key;
|
data->inputstr[inputlen - 2] = key;
|
||||||
data->inputstr[inputlen - 1] = '\0';
|
data->inputstr[inputlen - 1] = '\0';
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ window_copy_search_compare(
|
|||||||
|
|
||||||
gc = grid_peek_cell(gd, px, py);
|
gc = grid_peek_cell(gd, px, py);
|
||||||
sgc = grid_peek_cell(sgd, spx, 0);
|
sgc = grid_peek_cell(sgd, spx, 0);
|
||||||
|
|
||||||
if ((gc->flags & GRID_FLAG_UTF8) != (sgc->flags & GRID_FLAG_UTF8))
|
if ((gc->flags & GRID_FLAG_UTF8) != (sgc->flags & GRID_FLAG_UTF8))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr)
|
|||||||
lineno = strtonum(linestr, 0, screen_hsize(&wp->base), &errstr);
|
lineno = strtonum(linestr, 0, screen_hsize(&wp->base), &errstr);
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data->oy = lineno;
|
data->oy = lineno;
|
||||||
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';
|
||||||
}
|
}
|
||||||
|
@ -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 *);
|
||||||
@ -165,11 +165,11 @@ window_more_write_line(
|
|||||||
{
|
{
|
||||||
struct window_more_mode_data *data = wp->modedata;
|
struct window_more_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
struct options *oo = &wp->window->options;
|
struct options *oo = &wp->window->options;
|
||||||
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);
|
||||||
|
10
window.c
10
window.c
@ -189,7 +189,7 @@ winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl)
|
|||||||
|
|
||||||
if (wl == NULL)
|
if (wl == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TAILQ_FOREACH(wl2, stack, sentry) {
|
TAILQ_FOREACH(wl2, stack, sentry) {
|
||||||
if (wl2 == wl) {
|
if (wl2 == wl) {
|
||||||
TAILQ_REMOVE(stack, wl, sentry);
|
TAILQ_REMOVE(stack, wl, sentry);
|
||||||
@ -223,7 +223,7 @@ window_create1(u_int sx, u_int sy)
|
|||||||
|
|
||||||
w->lastlayout = -1;
|
w->lastlayout = -1;
|
||||||
w->layout_root = NULL;
|
w->layout_root = NULL;
|
||||||
|
|
||||||
w->sx = sx;
|
w->sx = sx;
|
||||||
w->sy = sy;
|
w->sy = sy;
|
||||||
|
|
||||||
@ -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));
|
||||||
@ -665,7 +665,7 @@ window_pane_parse(struct window_pane *wp)
|
|||||||
data = EVBUFFER_DATA(wp->event->input);
|
data = EVBUFFER_DATA(wp->event->input);
|
||||||
bufferevent_write(wp->pipe_event, data, new_size);
|
bufferevent_write(wp->pipe_event, data, new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_parse(wp);
|
input_parse(wp);
|
||||||
|
|
||||||
wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
|
wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
|
||||||
|
16
xterm-keys.c
16
xterm-keys.c
@ -27,11 +27,11 @@
|
|||||||
* character:
|
* character:
|
||||||
*
|
*
|
||||||
* 2 Shift
|
* 2 Shift
|
||||||
* 3 Alt
|
* 3 Alt
|
||||||
* 4 Shift + Alt
|
* 4 Shift + Alt
|
||||||
* 5 Ctrl
|
* 5 Ctrl
|
||||||
* 6 Shift + Ctrl
|
* 6 Shift + Ctrl
|
||||||
* 7 Alt + Ctrl
|
* 7 Alt + Ctrl
|
||||||
* 8 Shift + Alt + Ctrl
|
* 8 Shift + Alt + Ctrl
|
||||||
*
|
*
|
||||||
* Rather than parsing them, just match against a table.
|
* Rather than parsing them, just match against a table.
|
||||||
@ -85,7 +85,7 @@ struct xterm_keys_entry xterm_keys_table[] = {
|
|||||||
{ KEYC_DC, "\033[3;_~" },
|
{ KEYC_DC, "\033[3;_~" },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Match key against buffer, treating _ as a wildcard. Return -1 for no match,
|
* Match key against buffer, treating _ as a wildcard. Return -1 for no match,
|
||||||
* 0 for match, 1 if the end of the buffer is reached (need more data).
|
* 0 for match, 1 if the end of the buffer is reached (need more data).
|
||||||
*/
|
*/
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ xterm_keys_lookup(int key)
|
|||||||
}
|
}
|
||||||
if (i == nitems(xterm_keys_table))
|
if (i == nitems(xterm_keys_table))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
/* Copy the template and replace the modifier. */
|
/* Copy the template and replace the modifier. */
|
||||||
out = xstrdup(entry->template);
|
out = xstrdup(entry->template);
|
||||||
out[strcspn(out, "_")] = '0' + modifiers;
|
out[strcspn(out, "_")] = '0' + modifiers;
|
||||||
|
Loading…
Reference in New Issue
Block a user