diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-08-22 07:14:18 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-08-25 16:56:15 +0000 |
| commit | e570146c07b43ffacde6518e35b734b87095ed56 (patch) | |
| tree | 37040eff5cd0fbde190bff24f73b3b279aaa7799 /selection.c | |
| parent | selection: add a 2 second timeout when receiving clipboard data (diff) | |
selection: block non-paste data from being sent to client while pasting
While pasting data from the clipboard, block *all* other data from
being sent to the client. This includes keyboard and mouse events, but
also replies for VT queries.
This is particularly important when bracketed paste has been enabled,
since then the client will interpret *everything* between the
bracketed paste start and end as paste data.
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/selection.c b/selection.c index fc7b0308..4788ce61 100644 --- a/selection.c +++ b/selection.c @@ -1182,7 +1182,7 @@ static void from_clipboard_cb(const char *data, size_t size, void *user) { struct terminal *term = user; - term_to_slave(term, data, size); + term_paste_data_to_slave(term, data, size); } static void @@ -1191,7 +1191,13 @@ from_clipboard_done(void *user) struct terminal *term = user; if (term->bracketed_paste) - term_to_slave(term, "\033[201~", 6); + term_paste_data_to_slave(term, "\033[201~", 6); + + term->is_sending_paste_data = false; + + /* Make sure we send any queued up non-paste data */ + if (tll_length(term->ptmx_buffers) > 0) + fdm_event_add(term->fdm, term->ptmx, EPOLLOUT); } void @@ -1201,6 +1207,8 @@ selection_from_clipboard(struct seat *seat, struct terminal *term, uint32_t seri if (clipboard->data_offer == NULL) return; + term->is_sending_paste_data = true; + if (term->bracketed_paste) term_to_slave(term, "\033[200~", 6); @@ -1312,8 +1320,9 @@ selection_from_primary(struct seat *seat, struct terminal *term) if (clipboard->data_offer == NULL) return; + term->is_sending_paste_data = true; if (term->bracketed_paste) - term_to_slave(term, "\033[200~", 6); + term_paste_data_to_slave(term, "\033[200~", 6); text_from_primary(seat, term, &from_clipboard_cb, &from_clipboard_done, term); } |
