mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
selection: provide a const-wrapper for extract_one()
extract_one() takes const pointers, while the callback argument to foreach() expects non-const.
This commit is contained in:
parent
2539e3cbb2
commit
ffaa19ee22
1 changed files with 9 additions and 1 deletions
10
selection.c
10
selection.c
|
|
@ -195,6 +195,14 @@ foreach_selected(
|
|||
assert(false);
|
||||
}
|
||||
|
||||
static bool
|
||||
extract_one_const_wrapper(struct terminal *term,
|
||||
struct row *row, struct cell *cell,
|
||||
int col, void *data)
|
||||
{
|
||||
return extract_one(term, row, cell, col, data);
|
||||
}
|
||||
|
||||
static char *
|
||||
extract_selection(const struct terminal *term)
|
||||
{
|
||||
|
|
@ -204,7 +212,7 @@ extract_selection(const struct terminal *term)
|
|||
|
||||
foreach_selected(
|
||||
(struct terminal *)term, term->selection.start, term->selection.end,
|
||||
&extract_one, ctx);
|
||||
&extract_one_const_wrapper, ctx);
|
||||
|
||||
char *text;
|
||||
return extract_finish(ctx, &text, NULL) ? text : NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue