selection: allow HT, VT and FF, disallow NUL in non-bracketed paste mode

This syncs foot with more recent versions of XTerm, where it’s
“disallowedPasteControls” resource has changed its default value to

  BS,DEL,ENQ,EOT,ESC,NULL

Note that we’re already stripping out ENQ,EOT,ESC in all modes.

What does it mean for foot:

* HT, VT and FF are now allowed, regardless of paste mode
* NUL is now stripped in non-bracketed paste mode

Closes #1084
This commit is contained in:
Daniel Eklöf 2022-06-13 11:41:54 +02:00
parent d3c51b51b7
commit dbe2c0a068
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 22 additions and 3 deletions

View file

@ -57,6 +57,12 @@
* Use `$HOME` instead of `getpwuid()` to retrieve the users home
directory when searching for `foot.ini`.
* HT, VT and FF are no longer stripped when pasting in non-bracketed
mode ([#1084][1084]).
* NUL is now stripped when pasting in non-bracketed mode
([#1084][1084]).
[1084]: https://codeberg.org/dnkl/foot/issues/1084
### Deprecated

View file

@ -1845,9 +1845,22 @@ fdm_receive(struct fdm *fdm, int fd, int events, void *data)
skip_one();
goto again;
/* Additional control characters stripped by default (but
* configurable) in XTerm: BS, HT, DEL */
case '\b': case '\t': case '\v': case '\f': case '\x7f':
/*
* In addition to stripping non-formatting C0 controls,
* XTerm has an option, disallowedPasteControls, that
* defines C0 controls that will be replaced with spaces
* when pasted.
*
* Its default value is BS,DEL,ENQ,EOT,NUL
*
* Instead of replacing them with spaces, we allow them in
* bracketed paste mode, and strip them completely in
* non-bracketed mode.
*
* Note some of the (default) XTerm controls are already
* handled above.
*/
case '\b': case '\x7f': case '\x00':
if (!ctx->bracketed) {
skip_one();
goto again;