mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
selection: wip: update selection row-wise when initial selection was by row
This commit is contained in:
parent
30de262d29
commit
55ecf29a36
2 changed files with 24 additions and 3 deletions
25
selection.c
25
selection.c
|
|
@ -497,7 +497,11 @@ selection_update(struct terminal *term, int col, int row)
|
|||
}
|
||||
}
|
||||
|
||||
if (term->selection.semantic == SELECTION_SEMANTIC_WORD) {
|
||||
switch (term->selection.semantic) {
|
||||
case SELECTION_SEMANTIC_NONE:
|
||||
break;
|
||||
|
||||
case SELECTION_SEMANTIC_WORD:
|
||||
switch (term->selection.direction) {
|
||||
case SELECTION_LEFT:
|
||||
find_word_boundary_left(term, &new_end, false);
|
||||
|
|
@ -511,6 +515,23 @@ selection_update(struct terminal *term, int col, int row)
|
|||
assert(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SELECTION_SEMANTIC_ROW:
|
||||
switch (term->selection.direction) {
|
||||
case SELECTION_LEFT:
|
||||
new_end.col = 0;
|
||||
break;
|
||||
|
||||
case SELECTION_RIGHT:
|
||||
new_end.col = term->cols - 1;
|
||||
break;
|
||||
|
||||
case SELECTION_UNDIR:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* If an end point is in the middle of a multi-column character,
|
||||
|
|
@ -834,7 +855,7 @@ void
|
|||
selection_mark_row(
|
||||
struct seat *seat, struct terminal *term, int row, uint32_t serial)
|
||||
{
|
||||
selection_start(term, 0, row, SELECTION_NORMAL, SELECTION_SEMANTIC_NONE);
|
||||
selection_start(term, 0, row, SELECTION_NORMAL, SELECTION_SEMANTIC_ROW);
|
||||
selection_update(term, term->cols - 1, row);
|
||||
selection_finalize(seat, term, serial);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ enum mouse_reporting {
|
|||
enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BAR };
|
||||
|
||||
enum selection_kind { SELECTION_NONE, SELECTION_NORMAL, SELECTION_BLOCK };
|
||||
enum selection_semantic { SELECTION_SEMANTIC_NONE, SELECTION_SEMANTIC_WORD};
|
||||
enum selection_semantic { SELECTION_SEMANTIC_NONE, SELECTION_SEMANTIC_WORD, SELECTION_SEMANTIC_ROW};
|
||||
enum selection_direction {SELECTION_UNDIR, SELECTION_LEFT, SELECTION_RIGHT};
|
||||
enum selection_scroll_direction {SELECTION_SCROLL_NOT, SELECTION_SCROLL_UP, SELECTION_SCROLL_DOWN};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue