From 6e810fb677339ee00cc002447af63ba9fa520fcf Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 28 Apr 2025 19:56:32 -0400 Subject: [PATCH] Paste URL/regex selection to prompt if key is uppercase. Fixes #1975. In copy-regex/show-urls-copy mode, if the last input character was uppercase, copy the selection to the clipboard _and_ paste it. This is useful for taking a file path from a command output (log, git, test failure, etc.) and using it in another command. This is inspired by the behavior of copy mode in wezterm: https://wezterm.org/quickselect.html I could have made it check every character in the hint, but it seemed fine to assume that if the last character was uppercase, the user wanted this behavior. --- url-mode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/url-mode.c b/url-mode.c index d0f7fc53..db497523 100644 --- a/url-mode.c +++ b/url-mode.c @@ -277,6 +277,12 @@ urls_input(struct seat *seat, struct terminal *term, switch (match->action) { case URL_ACTION_COPY: + // If the last hint character was uppercase, copy and paste + if (wc >= 'A' && wc <= 'Z') { + term_to_slave(term, match->url, strlen(match->url)); + } + urls_reset(term); + break; case URL_ACTION_LAUNCH: urls_reset(term); break;