mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-07 04:06:07 -05:00
selection: find_word_boundary_{left,right}: treat spacers as word chars
This commit is contained in:
parent
3afc5a723e
commit
736ff0421c
1 changed files with 16 additions and 4 deletions
20
selection.c
20
selection.c
|
|
@ -243,7 +243,9 @@ find_word_boundary_left(struct terminal *term, struct coord *pos,
|
|||
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
||||
wchar_t c = r->cells[pos->col].wc;
|
||||
|
||||
if (!(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) {
|
||||
if (!(c != CELL_MULT_COL_SPACER &&
|
||||
(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))))
|
||||
{
|
||||
while (true) {
|
||||
int next_col = pos->col - 1;
|
||||
int next_row = pos->row;
|
||||
|
|
@ -258,8 +260,12 @@ find_word_boundary_left(struct terminal *term, struct coord *pos,
|
|||
const struct row *row = grid_row_in_view(term->grid, next_row);
|
||||
|
||||
c = row->cells[next_col].wc;
|
||||
if (c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))
|
||||
if (c != CELL_MULT_COL_SPACER &&
|
||||
(c == 0 ||
|
||||
!isword(c, spaces_only, term->conf->word_delimiters)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pos->col = next_col;
|
||||
pos->row = next_row;
|
||||
|
|
@ -274,7 +280,9 @@ find_word_boundary_right(struct terminal *term, struct coord *pos,
|
|||
const struct row *r = grid_row_in_view(term->grid, pos->row);
|
||||
wchar_t c = r->cells[pos->col].wc;
|
||||
|
||||
if (!(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))) {
|
||||
if (!(c != CELL_MULT_COL_SPACER &&
|
||||
(c == 0 || !isword(c, spaces_only, term->conf->word_delimiters))))
|
||||
{
|
||||
while (true) {
|
||||
int next_col = pos->col + 1;
|
||||
int next_row = pos->row;
|
||||
|
|
@ -289,8 +297,12 @@ find_word_boundary_right(struct terminal *term, struct coord *pos,
|
|||
const struct row *row = grid_row_in_view(term->grid, next_row);
|
||||
|
||||
c = row->cells[next_col].wc;
|
||||
if (c == '\0' || !isword(c, spaces_only, term->conf->word_delimiters))
|
||||
if (c != CELL_MULT_COL_SPACER &&
|
||||
(c == 0 ||
|
||||
!isword(c, spaces_only, term->conf->word_delimiters)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pos->col = next_col;
|
||||
pos->row = next_row;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue