diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-02 20:26:28 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-04 18:48:40 +0000 |
| commit | 55ecf29a36ac404ad41eb0050ff01caa35c3cb39 (patch) | |
| tree | c085a2aa2ae47d9590bdcc44bf2a742d5fb1424e /selection.c | |
| parent | selection: wip: update selection word-wise when initial selection was by word (diff) | |
selection: wip: update selection row-wise when initial selection was by row
Diffstat (limited to 'selection.c')
| -rw-r--r-- | selection.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/selection.c b/selection.c index 3653fa1b..615088d8 100644 --- a/selection.c +++ b/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); } |
