mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
config: add 'pipe-selected' key binding
This works just like pipe-visible and pipe-scrollback, but pipes the user-selected text, if any, to the external tool. Closes #51
This commit is contained in:
parent
33e25e7f93
commit
639a61abd8
8 changed files with 43 additions and 13 deletions
11
selection.c
11
selection.c
|
|
@ -204,9 +204,12 @@ extract_one_const_wrapper(struct terminal *term,
|
|||
return extract_one(term, row, cell, col, data);
|
||||
}
|
||||
|
||||
static char *
|
||||
extract_selection(const struct terminal *term)
|
||||
char *
|
||||
selection_to_text(const struct terminal *term)
|
||||
{
|
||||
if (term->selection.end.row == -1)
|
||||
return NULL;
|
||||
|
||||
struct extraction_context *ctx = extract_begin(term->selection.kind);
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
|
|
@ -873,7 +876,7 @@ selection_to_clipboard(struct seat *seat, struct terminal *term, uint32_t serial
|
|||
return;
|
||||
|
||||
/* Get selection as a string */
|
||||
char *text = extract_selection(term);
|
||||
char *text = selection_to_text(term);
|
||||
if (!text_to_clipboard(seat, term, text, serial))
|
||||
free(text);
|
||||
}
|
||||
|
|
@ -1074,7 +1077,7 @@ selection_to_primary(struct seat *seat, struct terminal *term, uint32_t serial)
|
|||
return;
|
||||
|
||||
/* Get selection as a string */
|
||||
char *text = extract_selection(term);
|
||||
char *text = selection_to_text(term);
|
||||
if (!text_to_primary(seat, term, text, serial))
|
||||
free(text);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue