mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-23 05:33:57 -04:00
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.
This commit is contained in:
parent
81222dac57
commit
e570146c07
3 changed files with 133 additions and 53 deletions
15
selection.c
15
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue