aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-02-02 20:17:01 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-02-02 20:17:01 +0000
commit5ee902551a44bb01429dec38fd5b315d94b28479 (patch)
treeae0f90b846771b7046ce8ac664376240536494a3
parentinstall: remove reference to the Arch AUR package (diff)
selection: don’t quote file URIs on the alt screen
Closes #379
-rw-r--r--CHANGELOG.md2
-rw-r--r--selection.c11
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f267fa2..960428fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -78,6 +78,8 @@
marked as obsolete by POSIX.
* `alt+tab` now emits `ESC \t` instead of `CSI 27;3;9~`
(https://codeberg.org/dnkl/foot/issues/900).
+* File pasted, or dropped, on the alt screen is no longer quoted
+ (https://codeberg.org/dnkl/foot/issues/379).
### Deprecated
diff --git a/selection.c b/selection.c
index 91523d3b..595fd1c8 100644
--- a/selection.c
+++ b/selection.c
@@ -1552,6 +1552,7 @@ struct clipboard_receive {
int timeout_fd;
struct itimerspec timeout;
bool bracketed;
+ bool quote_paths;
void (*decoder)(struct clipboard_receive *ctx, char *data, size_t size);
void (*finish)(struct clipboard_receive *ctx);
@@ -1641,9 +1642,13 @@ decode_one_uri(struct clipboard_receive *ctx, char *uri, size_t len)
ctx->add_space = true;
if (strcmp(scheme, "file") == 0 && hostname_is_localhost(host)) {
- ctx->cb("'", 1, ctx->user);
+ if (ctx->quote_paths)
+ ctx->cb("'", 1, ctx->user);
+
ctx->cb(path, strlen(path), ctx->user);
- ctx->cb("'", 1, ctx->user);
+
+ if (ctx->quote_paths)
+ ctx->cb("'", 1, ctx->user);
} else
ctx->cb(uri, len, ctx->user);
@@ -1830,6 +1835,7 @@ begin_receive_clipboard(struct terminal *term, int read_fd,
.timeout_fd = timeout_fd,
.timeout = timeout,
.bracketed = term->bracketed_paste,
+ .quote_paths = term->grid == &term->normal,
.decoder = (mime_type == DATA_OFFER_MIME_URI_LIST
? &fdm_receive_decoder_uri
: &fdm_receive_decoder_plain),
@@ -1900,6 +1906,7 @@ receive_offer(char *data, size_t size, void *user)
xassert(term->is_sending_paste_data);
term_paste_data_to_slave(term, data, size);
}
+
static void
receive_offer_done(void *user)
{