aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-06-13 09:41:54 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-06-15 17:09:40 +0000
commitdbe2c0a068fb0eda9b225f51b1df785d6f076de5 (patch)
tree4ef4133505a16c6fd413509705238af4e7046c36 /selection.c
parentpgo: slave_spawn(): sync function signature (diff)
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
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/selection.c b/selection.c
index 6b57f48c..37dd2c8d 100644
--- a/selection.c
+++ b/selection.c
@@ -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.
+ *
+ * It’s 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;