mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-05-29 21:38:03 -04:00
selection: do not copy empty text
Copy-on-select (configured with 'selection-target') may accidentally clear the clipboard, if the user drags the mouse a little bit when clicking inside a terminal window. Now we only copy if there is actual text being selected. Closes #2327
This commit is contained in:
parent
b18d8aa2f1
commit
4bf60d0fbc
2 changed files with 8 additions and 0 deletions
|
|
@ -1948,6 +1948,9 @@ static const struct zwp_primary_selection_source_v1_listener primary_selection_s
|
|||
bool
|
||||
text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t serial)
|
||||
{
|
||||
if (text == NULL || text[0] == '\0')
|
||||
return false;
|
||||
|
||||
xassert(serial != 0);
|
||||
|
||||
struct wl_clipboard *clipboard = &seat->clipboard;
|
||||
|
|
@ -2418,6 +2421,9 @@ selection_from_clipboard(struct seat *seat, struct terminal *term, uint32_t seri
|
|||
bool
|
||||
text_to_primary(struct seat *seat, struct terminal *term, char *text, uint32_t serial)
|
||||
{
|
||||
if (text == NULL || text[0] == '\0')
|
||||
return false;
|
||||
|
||||
if (term->wl->primary_selection_device_manager == NULL)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue