mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Tidy up mode-mouse check.
This commit is contained in:
parent
d24c9d7d3e
commit
79f52825b5
@ -49,7 +49,6 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
struct session *s;
|
struct session *s;
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
const char *sepstr, *bufname;
|
const char *sepstr, *bufname;
|
||||||
int pflag;
|
|
||||||
|
|
||||||
if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)
|
if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
@ -76,8 +75,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
else
|
else
|
||||||
sepstr = "\r";
|
sepstr = "\r";
|
||||||
}
|
}
|
||||||
pflag = (wp->screen->mode & MODE_BRACKETPASTE);
|
paste_send_pane(pb, wp, sepstr, args_has(args, 'p'));
|
||||||
paste_send_pane(pb, wp, sepstr, args_has(args, 'p') && pflag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the buffer if -d. */
|
/* Delete the buffer if -d. */
|
||||||
|
24
input-keys.c
24
input-keys.c
@ -205,6 +205,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
size_t len;
|
size_t len;
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
|
int event;
|
||||||
|
|
||||||
if (wp->screen->mode & ALL_MOUSE_MODES) {
|
if (wp->screen->mode & ALL_MOUSE_MODES) {
|
||||||
/*
|
/*
|
||||||
@ -238,19 +239,16 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) &&
|
if (options_get_number(&wp->window->options, "mode-mouse") != 1)
|
||||||
options_get_number(&wp->window->options, "mode-mouse") == 1) {
|
return;
|
||||||
|
event = m->event & (MOUSE_EVENT_CLICK|MOUSE_EVENT_WHEEL);
|
||||||
|
if (wp->mode == NULL && m->button == 1 && event == MOUSE_EVENT_CLICK) {
|
||||||
pb = paste_get_top();
|
pb = paste_get_top();
|
||||||
if (pb != NULL) {
|
if (pb != NULL)
|
||||||
paste_send_pane(pb, wp, "\r",
|
paste_send_pane(pb, wp, "\r", 1);
|
||||||
wp->screen->mode & MODE_BRACKETPASTE);
|
} else if (window_pane_set_mode(wp, &window_copy_mode) == 0) {
|
||||||
}
|
window_copy_init_from_pane(wp);
|
||||||
} else if (m->button != 1 &&
|
if (wp->mode->mouse != NULL)
|
||||||
options_get_number(&wp->window->options, "mode-mouse") == 1) {
|
wp->mode->mouse(wp, s, m);
|
||||||
if (window_pane_set_mode(wp, &window_copy_mode) == 0) {
|
|
||||||
window_copy_init_from_pane(wp);
|
|
||||||
if (wp->mode->mouse != NULL)
|
|
||||||
wp->mode->mouse(wp, s, m);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
paste.c
4
paste.c
@ -301,7 +301,7 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp,
|
|||||||
if (wp->flags & PANE_INPUTOFF)
|
if (wp->flags & PANE_INPUTOFF)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bracket)
|
if (bracket && (wp->screen->mode & MODE_BRACKETPASTE))
|
||||||
bufferevent_write(wp->event, "\033[200~", 6);
|
bufferevent_write(wp->event, "\033[200~", 6);
|
||||||
|
|
||||||
seplen = strlen(sep);
|
seplen = strlen(sep);
|
||||||
@ -315,6 +315,6 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp,
|
|||||||
if (end != data)
|
if (end != data)
|
||||||
bufferevent_write(wp->event, data, end - data);
|
bufferevent_write(wp->event, data, end - data);
|
||||||
|
|
||||||
if (bracket)
|
if (bracket && (wp->screen->mode & MODE_BRACKETPASTE))
|
||||||
bufferevent_write(wp->event, "\033[201~", 6);
|
bufferevent_write(wp->event, "\033[201~", 6);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user