mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-10 05:33:51 -04:00
osc: 52: clear selection if the payload is the empty string
This commit is contained in:
parent
d9675a7140
commit
499f019dea
2 changed files with 9 additions and 5 deletions
|
|
@ -114,6 +114,7 @@
|
||||||
only ([#1846][1846]).
|
only ([#1846][1846]).
|
||||||
* Drop required version of libxkbcommon from 1.8.0 back to 1.0.0
|
* Drop required version of libxkbcommon from 1.8.0 back to 1.0.0
|
||||||
([#2103][2103]).
|
([#2103][2103]).
|
||||||
|
* OSC-52: an empty payload now clears the clipboard.
|
||||||
|
|
||||||
[1846]: https://codeberg.org/dnkl/foot/issues/1846
|
[1846]: https://codeberg.org/dnkl/foot/issues/1846
|
||||||
[2103]: https://codeberg.org/dnkl/foot/issues/2103
|
[2103]: https://codeberg.org/dnkl/foot/issues/2103
|
||||||
|
|
|
||||||
13
osc.c
13
osc.c
|
|
@ -73,16 +73,19 @@ osc_to_clipboard(struct terminal *term, const char *target,
|
||||||
}
|
}
|
||||||
|
|
||||||
char *decoded = base64_decode(base64_data, NULL);
|
char *decoded = base64_decode(base64_data, NULL);
|
||||||
if (decoded == NULL) {
|
if (decoded == NULL || decoded[0] == '\0') {
|
||||||
if (errno == EINVAL)
|
if (decoded == NULL) {
|
||||||
LOG_WARN("OSC: invalid clipboard data: %s", base64_data);
|
if (errno == EINVAL)
|
||||||
else
|
LOG_WARN("OSC: invalid clipboard data: %s", base64_data);
|
||||||
LOG_ERRNO("base64_decode() failed");
|
else
|
||||||
|
LOG_ERRNO("base64_decode() failed");
|
||||||
|
}
|
||||||
|
|
||||||
if (to_clipboard)
|
if (to_clipboard)
|
||||||
selection_clipboard_unset(seat);
|
selection_clipboard_unset(seat);
|
||||||
if (to_primary)
|
if (to_primary)
|
||||||
selection_primary_unset(seat);
|
selection_primary_unset(seat);
|
||||||
|
free(decoded);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue