mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-24 23:59:03 +01:00
Merge branch 'obsd-master'
This commit is contained in:
commit
370cf75458
6
client.c
6
client.c
@ -561,7 +561,7 @@ client_dispatch_wait(void *data0)
|
|||||||
data = imsg.data;
|
data = imsg.data;
|
||||||
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
|
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
|
||||||
|
|
||||||
log_debug("got %d from server", imsg.hdr.type);
|
log_debug("got %u from server", imsg.hdr.type);
|
||||||
switch (imsg.hdr.type) {
|
switch (imsg.hdr.type) {
|
||||||
case MSG_EXIT:
|
case MSG_EXIT:
|
||||||
case MSG_SHUTDOWN:
|
case MSG_SHUTDOWN:
|
||||||
@ -608,7 +608,7 @@ client_dispatch_wait(void *data0)
|
|||||||
fatalx("bad MSG_VERSION size");
|
fatalx("bad MSG_VERSION size");
|
||||||
|
|
||||||
fprintf(stderr, "protocol version mismatch "
|
fprintf(stderr, "protocol version mismatch "
|
||||||
"(client %u, server %u)\n", PROTOCOL_VERSION,
|
"(client %d, server %u)\n", PROTOCOL_VERSION,
|
||||||
imsg.hdr.peerid);
|
imsg.hdr.peerid);
|
||||||
client_exitval = 1;
|
client_exitval = 1;
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ client_dispatch_attached(void)
|
|||||||
data = imsg.data;
|
data = imsg.data;
|
||||||
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
|
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
|
||||||
|
|
||||||
log_debug("got %d from server", imsg.hdr.type);
|
log_debug("got %u from server", imsg.hdr.type);
|
||||||
switch (imsg.hdr.type) {
|
switch (imsg.hdr.type) {
|
||||||
case MSG_DETACH:
|
case MSG_DETACH:
|
||||||
case MSG_DETACHKILL:
|
case MSG_DETACHKILL:
|
||||||
|
@ -104,18 +104,34 @@ cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, int key)
|
|||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd != MODEKEYCOPY_COPYPIPE) {
|
switch (cmd) {
|
||||||
if (args->argc != 2) {
|
case MODEKEYCOPY_APPENDSELECTION:
|
||||||
cmdq_error(cmdq, "no argument allowed");
|
case MODEKEYCOPY_COPYSELECTION:
|
||||||
return (CMD_RETURN_ERROR);
|
case MODEKEYCOPY_STARTNAMEDBUFFER:
|
||||||
|
if (args->argc == 2)
|
||||||
|
arg = NULL;
|
||||||
|
else {
|
||||||
|
arg = args->argv[2];
|
||||||
|
if (strcmp(arg, "-x") != 0) {
|
||||||
|
cmdq_error(cmdq, "unknown argument");
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
arg = NULL;
|
break;
|
||||||
} else {
|
case MODEKEYCOPY_COPYPIPE:
|
||||||
if (args->argc != 3) {
|
if (args->argc != 3) {
|
||||||
cmdq_error(cmdq, "no argument given");
|
cmdq_error(cmdq, "no argument given");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
arg = args->argv[2];
|
arg = args->argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (args->argc != 2) {
|
||||||
|
cmdq_error(cmdq, "no argument allowed");
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
|
arg = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtmp.key = key;
|
mtmp.key = key;
|
||||||
|
@ -74,7 +74,7 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp,
|
|||||||
tmp[0] = line[i];
|
tmp[0] = line[i];
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
} else
|
} else
|
||||||
xsnprintf(tmp, sizeof tmp, "\\%03o", line[i]);
|
xsnprintf(tmp, sizeof tmp, "\\%03hho", line[i]);
|
||||||
buf = cmd_capture_pane_append(buf, len, tmp,
|
buf = cmd_capture_pane_append(buf, len, tmp,
|
||||||
strlen(tmp));
|
strlen(tmp));
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
if (!args_has(self->args, 'k') && wp->fd != -1) {
|
if (!args_has(self->args, 'k') && wp->fd != -1) {
|
||||||
if (window_pane_index(wp, &idx) != 0)
|
if (window_pane_index(wp, &idx) != 0)
|
||||||
fatalx("index not found");
|
fatalx("index not found");
|
||||||
cmdq_error(cmdq, "pane still active: %s:%u.%u",
|
cmdq_error(cmdq, "pane still active: %s:%d.%u",
|
||||||
s->name, wl->idx, idx);
|
s->name, wl->idx, idx);
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
2
colour.c
2
colour.c
@ -147,7 +147,7 @@ colour_tostring(int c)
|
|||||||
static char s[32];
|
static char s[32];
|
||||||
|
|
||||||
if (c & 0x100) {
|
if (c & 0x100) {
|
||||||
xsnprintf(s, sizeof s, "colour%u", c & ~0x100);
|
xsnprintf(s, sizeof s, "colour%d", c & ~0x100);
|
||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
63
format.c
63
format.c
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
int format_replace(struct format_tree *, const char *, size_t, char **,
|
int format_replace(struct format_tree *, const char *, size_t, char **,
|
||||||
size_t *, size_t *);
|
size_t *, size_t *);
|
||||||
|
char *format_time_string(time_t);
|
||||||
char *format_get_command(struct window_pane *);
|
char *format_get_command(struct window_pane *);
|
||||||
|
|
||||||
void format_defaults_pane_tabs(struct format_tree *, struct window_pane *);
|
void format_defaults_pane_tabs(struct format_tree *, struct window_pane *);
|
||||||
@ -454,6 +455,18 @@ format_get_command(struct window_pane *wp)
|
|||||||
return (out);
|
return (out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get time as a string. */
|
||||||
|
char *
|
||||||
|
format_time_string(time_t t)
|
||||||
|
{
|
||||||
|
char *tim;
|
||||||
|
|
||||||
|
tim = ctime(&t);
|
||||||
|
*strchr(tim, '\n') = '\0';
|
||||||
|
|
||||||
|
return (tim);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set defaults for any of arguments that are not NULL. */
|
/* Set defaults for any of arguments that are not NULL. */
|
||||||
void
|
void
|
||||||
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
|
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
|
||||||
@ -481,7 +494,6 @@ void
|
|||||||
format_defaults_session(struct format_tree *ft, struct session *s)
|
format_defaults_session(struct format_tree *ft, struct session *s)
|
||||||
{
|
{
|
||||||
struct session_group *sg;
|
struct session_group *sg;
|
||||||
char *tim;
|
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
ft->s = s;
|
ft->s = s;
|
||||||
@ -499,21 +511,22 @@ format_defaults_session(struct format_tree *ft, struct session *s)
|
|||||||
|
|
||||||
t = s->creation_time.tv_sec;
|
t = s->creation_time.tv_sec;
|
||||||
format_add(ft, "session_created", "%lld", (long long) t);
|
format_add(ft, "session_created", "%lld", (long long) t);
|
||||||
tim = ctime(&t);
|
format_add(ft, "session_created_string", "%s", format_time_string(t));
|
||||||
*strchr(tim, '\n') = '\0';
|
|
||||||
format_add(ft, "session_created_string", "%s", tim);
|
t = s->activity_time.tv_sec;
|
||||||
|
format_add(ft, "session_activity", "%lld", (long long) t);
|
||||||
|
format_add(ft, "session_activity_string", "%s", format_time_string(t));
|
||||||
|
|
||||||
format_add(ft, "session_attached", "%u", s->attached);
|
format_add(ft, "session_attached", "%u", s->attached);
|
||||||
format_add(ft, "session_many_attached", "%u", s->attached > 1);
|
format_add(ft, "session_many_attached", "%d", s->attached > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set default format keys for a client. */
|
/* Set default format keys for a client. */
|
||||||
void
|
void
|
||||||
format_defaults_client(struct format_tree *ft, struct client *c)
|
format_defaults_client(struct format_tree *ft, struct client *c)
|
||||||
{
|
{
|
||||||
char *tim;
|
|
||||||
time_t t;
|
|
||||||
struct session *s;
|
struct session *s;
|
||||||
|
time_t t;
|
||||||
|
|
||||||
if (ft->s == NULL)
|
if (ft->s == NULL)
|
||||||
ft->s = c->session;
|
ft->s = c->session;
|
||||||
@ -527,15 +540,11 @@ format_defaults_client(struct format_tree *ft, struct client *c)
|
|||||||
|
|
||||||
t = c->creation_time.tv_sec;
|
t = c->creation_time.tv_sec;
|
||||||
format_add(ft, "client_created", "%lld", (long long) t);
|
format_add(ft, "client_created", "%lld", (long long) t);
|
||||||
tim = ctime(&t);
|
format_add(ft, "client_created_string", "%s", format_time_string(t));
|
||||||
*strchr(tim, '\n') = '\0';
|
|
||||||
format_add(ft, "client_created_string", "%s", tim);
|
|
||||||
|
|
||||||
t = c->activity_time.tv_sec;
|
t = c->activity_time.tv_sec;
|
||||||
format_add(ft, "client_activity", "%lld", (long long) t);
|
format_add(ft, "client_activity", "%lld", (long long) t);
|
||||||
tim = ctime(&t);
|
format_add(ft, "client_activity_string", "%s", format_time_string(t));
|
||||||
*strchr(tim, '\n') = '\0';
|
|
||||||
format_add(ft, "client_activity_string", "%s", tim);
|
|
||||||
|
|
||||||
format_add(ft, "client_prefix", "%d", !!(c->flags & CLIENT_PREFIX));
|
format_add(ft, "client_prefix", "%d", !!(c->flags & CLIENT_PREFIX));
|
||||||
|
|
||||||
@ -573,7 +582,7 @@ format_defaults_window(struct format_tree *ft, struct window *w)
|
|||||||
format_add(ft, "window_height", "%u", w->sy);
|
format_add(ft, "window_height", "%u", w->sy);
|
||||||
format_add(ft, "window_layout", "%s", layout);
|
format_add(ft, "window_layout", "%s", layout);
|
||||||
format_add(ft, "window_panes", "%u", window_count_panes(w));
|
format_add(ft, "window_panes", "%u", window_count_panes(w));
|
||||||
format_add(ft, "window_zoomed_flag", "%u",
|
format_add(ft, "window_zoomed_flag", "%d",
|
||||||
!!(w->flags & WINDOW_ZOOMED));
|
!!(w->flags & WINDOW_ZOOMED));
|
||||||
|
|
||||||
free(layout);
|
free(layout);
|
||||||
@ -598,13 +607,13 @@ format_defaults_winlink(struct format_tree *ft, struct session *s,
|
|||||||
format_add(ft, "window_flags", "%s", flags);
|
format_add(ft, "window_flags", "%s", flags);
|
||||||
format_add(ft, "window_active", "%d", wl == s->curw);
|
format_add(ft, "window_active", "%d", wl == s->curw);
|
||||||
|
|
||||||
format_add(ft, "window_bell_flag", "%u",
|
format_add(ft, "window_bell_flag", "%d",
|
||||||
!!(wl->flags & WINLINK_BELL));
|
!!(wl->flags & WINLINK_BELL));
|
||||||
format_add(ft, "window_activity_flag", "%u",
|
format_add(ft, "window_activity_flag", "%d",
|
||||||
!!(wl->flags & WINLINK_ACTIVITY));
|
!!(wl->flags & WINLINK_ACTIVITY));
|
||||||
format_add(ft, "window_silence_flag", "%u",
|
format_add(ft, "window_silence_flag", "%d",
|
||||||
!!(wl->flags & WINLINK_SILENCE));
|
!!(wl->flags & WINLINK_SILENCE));
|
||||||
format_add(ft, "window_last_flag", "%u",
|
format_add(ft, "window_last_flag", "%d",
|
||||||
!!(wl == TAILQ_FIRST(&s->lastw)));
|
!!(wl == TAILQ_FIRST(&s->lastw)));
|
||||||
|
|
||||||
free(flags);
|
free(flags);
|
||||||
@ -624,7 +633,7 @@ format_defaults_pane_tabs(struct format_tree *ft, struct window_pane *wp)
|
|||||||
|
|
||||||
if (EVBUFFER_LENGTH(buffer) > 0)
|
if (EVBUFFER_LENGTH(buffer) > 0)
|
||||||
evbuffer_add(buffer, ",", 1);
|
evbuffer_add(buffer, ",", 1);
|
||||||
evbuffer_add_printf(buffer, "%d", i);
|
evbuffer_add_printf(buffer, "%u", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
format_add(ft, "pane_tabs", "%.*s", (int) EVBUFFER_LENGTH(buffer),
|
format_add(ft, "pane_tabs", "%.*s", (int) EVBUFFER_LENGTH(buffer),
|
||||||
@ -697,16 +706,16 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
format_add(ft, "cursor_x", "%d", wp->base.cx);
|
format_add(ft, "cursor_x", "%u", wp->base.cx);
|
||||||
format_add(ft, "cursor_y", "%d", wp->base.cy);
|
format_add(ft, "cursor_y", "%u", wp->base.cy);
|
||||||
format_add(ft, "scroll_region_upper", "%d", wp->base.rupper);
|
format_add(ft, "scroll_region_upper", "%u", wp->base.rupper);
|
||||||
format_add(ft, "scroll_region_lower", "%d", wp->base.rlower);
|
format_add(ft, "scroll_region_lower", "%u", wp->base.rlower);
|
||||||
format_add(ft, "saved_cursor_x", "%d", wp->ictx.old_cx);
|
format_add(ft, "saved_cursor_x", "%u", wp->ictx.old_cx);
|
||||||
format_add(ft, "saved_cursor_y", "%d", wp->ictx.old_cy);
|
format_add(ft, "saved_cursor_y", "%u", wp->ictx.old_cy);
|
||||||
|
|
||||||
format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0);
|
format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0);
|
||||||
format_add(ft, "alternate_saved_x", "%d", wp->saved_cx);
|
format_add(ft, "alternate_saved_x", "%u", wp->saved_cx);
|
||||||
format_add(ft, "alternate_saved_y", "%d", wp->saved_cy);
|
format_add(ft, "alternate_saved_y", "%u", wp->saved_cy);
|
||||||
|
|
||||||
format_add(ft, "cursor_flag", "%d",
|
format_add(ft, "cursor_flag", "%d",
|
||||||
!!(wp->base.mode & MODE_CURSOR));
|
!!(wp->base.mode & MODE_CURSOR));
|
||||||
|
@ -218,7 +218,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
|
|||||||
* legacy format.
|
* legacy format.
|
||||||
*/
|
*/
|
||||||
if (m->sgr && (wp->screen->mode & MODE_MOUSE_SGR)) {
|
if (m->sgr && (wp->screen->mode & MODE_MOUSE_SGR)) {
|
||||||
len = xsnprintf(buf, sizeof buf, "\033[<%d;%d;%d%c",
|
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
|
||||||
m->sgr_xb, m->x + 1, m->y + 1,
|
m->sgr_xb, m->x + 1, m->y + 1,
|
||||||
m->sgr_rel ? 'm' : 'M');
|
m->sgr_rel ? 'm' : 'M');
|
||||||
} else if (wp->screen->mode & MODE_MOUSE_UTF8) {
|
} else if (wp->screen->mode & MODE_MOUSE_UTF8) {
|
||||||
|
2
input.c
2
input.c
@ -1717,7 +1717,7 @@ void
|
|||||||
input_exit_osc(struct input_ctx *ictx)
|
input_exit_osc(struct input_ctx *ictx)
|
||||||
{
|
{
|
||||||
u_char *p = ictx->input_buf;
|
u_char *p = ictx->input_buf;
|
||||||
int option;
|
u_int option;
|
||||||
|
|
||||||
if (ictx->flags & INPUT_DISCARD)
|
if (ictx->flags & INPUT_DISCARD)
|
||||||
return;
|
return;
|
||||||
|
6
paste.c
6
paste.c
@ -246,9 +246,6 @@ paste_set(char *data, size_t size, const char *name, char **cause)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pb = paste_get_name(name);
|
|
||||||
if (pb != NULL)
|
|
||||||
paste_free_name(name);
|
|
||||||
|
|
||||||
pb = xmalloc(sizeof *pb);
|
pb = xmalloc(sizeof *pb);
|
||||||
|
|
||||||
@ -260,6 +257,9 @@ paste_set(char *data, size_t size, const char *name, char **cause)
|
|||||||
pb->automatic = 0;
|
pb->automatic = 0;
|
||||||
pb->order = paste_next_order++;
|
pb->order = paste_next_order++;
|
||||||
|
|
||||||
|
if (paste_get_name(name) != NULL)
|
||||||
|
paste_free_name(name);
|
||||||
|
|
||||||
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
||||||
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ server_client_msg_dispatch(struct client *c)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("got %d from client %d", imsg.hdr.type, c->ibuf.fd);
|
log_debug("got %u from client %d", imsg.hdr.type, c->ibuf.fd);
|
||||||
switch (imsg.hdr.type) {
|
switch (imsg.hdr.type) {
|
||||||
case MSG_IDENTIFY_FLAGS:
|
case MSG_IDENTIFY_FLAGS:
|
||||||
case MSG_IDENTIFY_TERM:
|
case MSG_IDENTIFY_TERM:
|
||||||
|
@ -41,9 +41,9 @@ server_fill_environ(struct session *s, struct environ *env)
|
|||||||
|
|
||||||
idx = s->id;
|
idx = s->id;
|
||||||
} else
|
} else
|
||||||
idx = -1;
|
idx = (u_int)-1;
|
||||||
pid = getpid();
|
pid = getpid();
|
||||||
xsnprintf(var, sizeof var, "%s,%ld,%d", socket_path, pid, idx);
|
xsnprintf(var, sizeof var, "%s,%ld,%u", socket_path, pid, idx);
|
||||||
environ_set(env, "TMUX", var);
|
environ_set(env, "TMUX", var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
|
|||||||
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");
|
||||||
else if (action == BELL_ANY)
|
else if (action == BELL_ANY)
|
||||||
status_message_set(c, "Bell in window %u", wl->idx);
|
status_message_set(c, "Bell in window %d", wl->idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -124,7 +124,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
|
|||||||
c = ARRAY_ITEM(&clients, i);
|
c = ARRAY_ITEM(&clients, i);
|
||||||
if (c == NULL || c->session != s)
|
if (c == NULL || c->session != s)
|
||||||
continue;
|
continue;
|
||||||
status_message_set(c, "Activity in window %u", wl->idx);
|
status_message_set(c, "Activity in window %d", wl->idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ server_window_check_silence(struct session *s, struct winlink *wl)
|
|||||||
c = ARRAY_ITEM(&clients, i);
|
c = ARRAY_ITEM(&clients, i);
|
||||||
if (c == NULL || c->session != s)
|
if (c == NULL || c->session != s)
|
||||||
continue;
|
continue;
|
||||||
status_message_set(c, "Silence in window %u", wl->idx);
|
status_message_set(c, "Silence in window %d", wl->idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
style.c
12
style.c
@ -160,13 +160,21 @@ style_update_new(struct options *oo, const char *name, const char *newname)
|
|||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
struct grid_cell *gc;
|
struct grid_cell *gc;
|
||||||
|
struct options_entry *o;
|
||||||
|
|
||||||
/* It's a colour or attribute, but with no -style equivalent. */
|
/* It's a colour or attribute, but with no -style equivalent. */
|
||||||
if (newname == NULL)
|
if (newname == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gc = options_get_style(oo, newname);
|
o = options_find1(oo, newname);
|
||||||
value = options_get_number(oo, name);
|
if (o == NULL)
|
||||||
|
o = options_set_style (oo, newname, "default", 0);
|
||||||
|
gc = &o->style;
|
||||||
|
|
||||||
|
o = options_find1(oo, name);
|
||||||
|
if (o == NULL)
|
||||||
|
o = options_set_number (oo, name, 8);
|
||||||
|
value = o->num;
|
||||||
|
|
||||||
if (strstr(name, "-bg") != NULL)
|
if (strstr(name, "-bg") != NULL)
|
||||||
colour_set_bg(gc, value);
|
colour_set_bg(gc, value);
|
||||||
|
28
tmux.1
28
tmux.1
@ -751,7 +751,7 @@ behave like
|
|||||||
.Ic attach-session
|
.Ic attach-session
|
||||||
if
|
if
|
||||||
.Ar session-name
|
.Ar session-name
|
||||||
already exists; in the case,
|
already exists; in this case,
|
||||||
.Fl D
|
.Fl D
|
||||||
behaves like
|
behaves like
|
||||||
.Fl d
|
.Fl d
|
||||||
@ -991,15 +991,27 @@ command and keys modified or removed with
|
|||||||
.Ic bind-key
|
.Ic bind-key
|
||||||
and
|
and
|
||||||
.Ic unbind-key .
|
.Ic unbind-key .
|
||||||
One command accepts an argument,
|
If
|
||||||
.Ic copy-pipe ,
|
.Ic append-selection ,
|
||||||
which copies the selection and pipes it to a command.
|
.Ic copy-selection ,
|
||||||
|
or
|
||||||
|
.Ic start-named-buffer
|
||||||
|
are given the
|
||||||
|
.Fl x
|
||||||
|
flag,
|
||||||
|
.Nm
|
||||||
|
will not exit copy mode after copying.
|
||||||
|
.Ic copy-pipe
|
||||||
|
copies the selection and pipes it to a command.
|
||||||
For example the following will bind
|
For example the following will bind
|
||||||
|
.Ql C-w
|
||||||
|
not to exit after copying and
|
||||||
.Ql C-q
|
.Ql C-q
|
||||||
to copy the selection into
|
to copy the selection into
|
||||||
.Pa /tmp
|
.Pa /tmp
|
||||||
as well as the paste buffer:
|
as well as the paste buffer:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
|
bind-key -temacs-copy C-w copy-selection -x
|
||||||
bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
|
bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@ -2503,9 +2515,9 @@ variable is set.
|
|||||||
String used to set the window title if
|
String used to set the window title if
|
||||||
.Ic set-titles
|
.Ic set-titles
|
||||||
is on.
|
is on.
|
||||||
Character sequences are replaced as for the
|
Formats are expanded, see the
|
||||||
.Ic status-left
|
.Sx FORMATS
|
||||||
option.
|
section.
|
||||||
.It Xo Ic status
|
.It Xo Ic status
|
||||||
.Op Ic on | off
|
.Op Ic on | off
|
||||||
.Xc
|
.Xc
|
||||||
@ -3153,6 +3165,8 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
|
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
|
||||||
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
|
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
|
||||||
.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
|
.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
|
||||||
|
.It Li "session_activity" Ta "" Ta "Integer time of session last activity"
|
||||||
|
.It Li "session_activity_string" Ta "" Ta "String time of session last activity"
|
||||||
.It Li "session_created" Ta "" Ta "Integer time session created"
|
.It Li "session_created" Ta "" Ta "Integer time session created"
|
||||||
.It Li "session_created_string" Ta "" Ta "String time session created"
|
.It Li "session_created_string" Ta "" Ta "String time session created"
|
||||||
.It Li "session_group" Ta "" Ta "Number of session group"
|
.It Li "session_group" Ta "" Ta "Number of session group"
|
||||||
|
36
tty.c
36
tty.c
@ -629,7 +629,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
|||||||
sx = tty->sx;
|
sx = tty->sx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't move the cursor to the start permission if it will wrap there
|
* Don't move the cursor to the start position if it will wrap there
|
||||||
* itself.
|
* itself.
|
||||||
*/
|
*/
|
||||||
gl = NULL;
|
gl = NULL;
|
||||||
@ -1407,7 +1407,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc)
|
|||||||
*
|
*
|
||||||
* Otherwise, try to set the default colour only as needed.
|
* Otherwise, try to set the default colour only as needed.
|
||||||
*/
|
*/
|
||||||
have_ax = tty_term_has(tty->term, TTYC_AX);
|
have_ax = tty_term_flag(tty->term, TTYC_AX);
|
||||||
if (!have_ax && tty_term_has(tty->term, TTYC_OP))
|
if (!have_ax && tty_term_has(tty->term, TTYC_OP))
|
||||||
tty_reset(tty);
|
tty_reset(tty);
|
||||||
else {
|
else {
|
||||||
@ -1453,6 +1453,8 @@ tty_check_fg(struct tty *tty, struct grid_cell *gc)
|
|||||||
{
|
{
|
||||||
u_int colours;
|
u_int colours;
|
||||||
|
|
||||||
|
colours = tty_term_number(tty->term, TTYC_COLORS);
|
||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_FG256) {
|
if (gc->flags & GRID_FLAG_FG256) {
|
||||||
/* And not a 256 colour mode? */
|
/* And not a 256 colour mode? */
|
||||||
@ -1461,7 +1463,10 @@ tty_check_fg(struct tty *tty, struct grid_cell *gc)
|
|||||||
gc->fg = colour_256to16(gc->fg);
|
gc->fg = colour_256to16(gc->fg);
|
||||||
if (gc->fg & 8) {
|
if (gc->fg & 8) {
|
||||||
gc->fg &= 7;
|
gc->fg &= 7;
|
||||||
gc->attr |= GRID_ATTR_BRIGHT;
|
if (colours >= 16)
|
||||||
|
gc->fg += 90;
|
||||||
|
else
|
||||||
|
gc->attr |= GRID_ATTR_BRIGHT;
|
||||||
} else
|
} else
|
||||||
gc->attr &= ~GRID_ATTR_BRIGHT;
|
gc->attr &= ~GRID_ATTR_BRIGHT;
|
||||||
gc->flags &= ~GRID_FLAG_FG256;
|
gc->flags &= ~GRID_FLAG_FG256;
|
||||||
@ -1470,7 +1475,6 @@ tty_check_fg(struct tty *tty, struct grid_cell *gc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Is this an aixterm colour? */
|
/* Is this an aixterm colour? */
|
||||||
colours = tty_term_number(tty->term, TTYC_COLORS);
|
|
||||||
if (gc->fg >= 90 && gc->fg <= 97 && colours < 16) {
|
if (gc->fg >= 90 && gc->fg <= 97 && colours < 16) {
|
||||||
gc->fg -= 90;
|
gc->fg -= 90;
|
||||||
gc->attr |= GRID_ATTR_BRIGHT;
|
gc->attr |= GRID_ATTR_BRIGHT;
|
||||||
@ -1482,6 +1486,8 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
|
|||||||
{
|
{
|
||||||
u_int colours;
|
u_int colours;
|
||||||
|
|
||||||
|
colours = tty_term_number(tty->term, TTYC_COLORS);
|
||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_BG256) {
|
if (gc->flags & GRID_FLAG_BG256) {
|
||||||
/*
|
/*
|
||||||
@ -1492,20 +1498,19 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
|
|||||||
if (!(tty->term->flags & TERM_256COLOURS) &&
|
if (!(tty->term->flags & TERM_256COLOURS) &&
|
||||||
!(tty->term_flags & TERM_256COLOURS)) {
|
!(tty->term_flags & TERM_256COLOURS)) {
|
||||||
gc->bg = colour_256to16(gc->bg);
|
gc->bg = colour_256to16(gc->bg);
|
||||||
if (gc->bg & 8)
|
if (gc->bg & 8) {
|
||||||
gc->bg &= 7;
|
gc->bg &= 7;
|
||||||
gc->attr &= ~GRID_ATTR_BRIGHT;
|
if (colours >= 16)
|
||||||
|
gc->fg += 90;
|
||||||
|
}
|
||||||
gc->flags &= ~GRID_FLAG_BG256;
|
gc->flags &= ~GRID_FLAG_BG256;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is this an aixterm colour? */
|
/* Is this an aixterm colour? */
|
||||||
colours = tty_term_number(tty->term, TTYC_COLORS);
|
if (gc->bg >= 90 && gc->bg <= 97 && colours < 16)
|
||||||
if (gc->bg >= 90 && gc->bg <= 97 && colours < 16) {
|
|
||||||
gc->bg -= 90;
|
gc->bg -= 90;
|
||||||
gc->attr |= GRID_ATTR_BRIGHT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1559,14 +1564,9 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Is this an aixterm bright colour? */
|
/* Is this an aixterm bright colour? */
|
||||||
if (bg >= 90 && bg <= 97) {
|
if (bg >= 90 && bg <= 97) {
|
||||||
/* 16 colour terminals or above only. */
|
xsnprintf(s, sizeof s, "\033[%dm", bg + 10);
|
||||||
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {
|
tty_puts(tty, s);
|
||||||
xsnprintf(s, sizeof s, "\033[%dm", bg + 10);
|
goto save_bg;
|
||||||
tty_puts(tty, s);
|
|
||||||
goto save_bg;
|
|
||||||
}
|
|
||||||
bg -= 90;
|
|
||||||
/* no such thing as a bold background */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise set the background colour. */
|
/* Otherwise set the background colour. */
|
||||||
|
@ -98,7 +98,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
|
|||||||
item->pos = ARRAY_LENGTH(&data->list) - 1;
|
item->pos = ARRAY_LENGTH(&data->list) - 1;
|
||||||
item->state = 0;
|
item->state = 0;
|
||||||
|
|
||||||
data->width = xsnprintf(tmp, sizeof tmp , "%u", item->pos);
|
data->width = xsnprintf(tmp, sizeof tmp , "%d", item->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -147,6 +147,7 @@ struct window_copy_mode_data {
|
|||||||
enum window_copy_input_type inputtype;
|
enum window_copy_input_type inputtype;
|
||||||
const char *inputprompt;
|
const char *inputprompt;
|
||||||
char *inputstr;
|
char *inputstr;
|
||||||
|
int inputexit;
|
||||||
|
|
||||||
int numprefix;
|
int numprefix;
|
||||||
|
|
||||||
@ -424,8 +425,12 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
|
|||||||
case MODEKEYCOPY_APPENDSELECTION:
|
case MODEKEYCOPY_APPENDSELECTION:
|
||||||
if (sess != NULL) {
|
if (sess != NULL) {
|
||||||
window_copy_append_selection(wp, NULL);
|
window_copy_append_selection(wp, NULL);
|
||||||
window_pane_reset_mode(wp);
|
if (arg == NULL) {
|
||||||
return;
|
window_pane_reset_mode(wp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window_copy_clear_selection(wp);
|
||||||
|
window_copy_redraw_screen(wp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_CANCEL:
|
case MODEKEYCOPY_CANCEL:
|
||||||
@ -572,8 +577,12 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
|
|||||||
case MODEKEYCOPY_COPYSELECTION:
|
case MODEKEYCOPY_COPYSELECTION:
|
||||||
if (sess != NULL) {
|
if (sess != NULL) {
|
||||||
window_copy_copy_selection(wp, NULL);
|
window_copy_copy_selection(wp, NULL);
|
||||||
window_pane_reset_mode(wp);
|
if (arg == NULL) {
|
||||||
return;
|
window_pane_reset_mode(wp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window_copy_clear_selection(wp);
|
||||||
|
window_copy_redraw_screen(wp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_STARTOFLINE:
|
case MODEKEYCOPY_STARTOFLINE:
|
||||||
@ -718,6 +727,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
|
|||||||
goto input_on;
|
goto input_on;
|
||||||
case MODEKEYCOPY_STARTNAMEDBUFFER:
|
case MODEKEYCOPY_STARTNAMEDBUFFER:
|
||||||
data->inputtype = WINDOW_COPY_NAMEDBUFFER;
|
data->inputtype = WINDOW_COPY_NAMEDBUFFER;
|
||||||
|
data->inputexit = (arg == NULL);
|
||||||
data->inputprompt = "Buffer";
|
data->inputprompt = "Buffer";
|
||||||
*data->inputstr = '\0';
|
*data->inputstr = '\0';
|
||||||
goto input_on;
|
goto input_on;
|
||||||
@ -828,8 +838,13 @@ window_copy_key_input(struct window_pane *wp, int key)
|
|||||||
case WINDOW_COPY_NAMEDBUFFER:
|
case WINDOW_COPY_NAMEDBUFFER:
|
||||||
window_copy_copy_selection(wp, data->inputstr);
|
window_copy_copy_selection(wp, data->inputstr);
|
||||||
*data->inputstr = '\0';
|
*data->inputstr = '\0';
|
||||||
window_pane_reset_mode(wp);
|
if (data->inputexit) {
|
||||||
return (0);
|
window_pane_reset_mode(wp);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
window_copy_clear_selection(wp);
|
||||||
|
window_copy_redraw_screen(wp);
|
||||||
|
break;
|
||||||
case WINDOW_COPY_GOTOLINE:
|
case WINDOW_COPY_GOTOLINE:
|
||||||
window_copy_goto_line(wp, data->inputstr);
|
window_copy_goto_line(wp, data->inputstr);
|
||||||
*data->inputstr = '\0';
|
*data->inputstr = '\0';
|
||||||
@ -1216,7 +1231,7 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
|
|||||||
limit = screen_size_x(s) + 1;
|
limit = screen_size_x(s) + 1;
|
||||||
if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
|
if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
|
||||||
xoff = size = xsnprintf(hdr, limit,
|
xoff = size = xsnprintf(hdr, limit,
|
||||||
"Repeat: %u", data->numprefix);
|
"Repeat: %d", data->numprefix);
|
||||||
} else {
|
} else {
|
||||||
xoff = size = xsnprintf(hdr, limit,
|
xoff = size = xsnprintf(hdr, limit,
|
||||||
"%s: %s", data->inputprompt, data->inputstr);
|
"%s: %s", data->inputprompt, data->inputstr);
|
||||||
|
Loading…
Reference in New Issue
Block a user