mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-16 08:21:20 -04:00
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.
This commit is contained in:
parent
d7b48d3924
commit
6e810fb677
1 changed files with 6 additions and 0 deletions
|
|
@ -277,6 +277,12 @@ urls_input(struct seat *seat, struct terminal *term,
|
||||||
|
|
||||||
switch (match->action) {
|
switch (match->action) {
|
||||||
case URL_ACTION_COPY:
|
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:
|
case URL_ACTION_LAUNCH:
|
||||||
urls_reset(term);
|
urls_reset(term);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue