aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-18 12:57:31 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-18 12:57:31 +0000
commit006c75d2d3bff050ec5cb40b73c02c7b35608549 (patch)
tree5d586613e86e1f112bf5b143b4de64146d483662
parentsearch: input: log consumed modifiers (diff)
search: rename ‘newline’ -> ‘advance_pos’ macro, reverse return value
-rw-r--r--search.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/search.c b/search.c
index 575694a1..58397406 100644
--- a/search.c
+++ b/search.c
@@ -609,21 +609,21 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
struct coord new_end = old_end;
struct row *row = NULL;
-#define newline(coord) __extension__ \
+#define advance_pos(coord) __extension__ \
({ \
bool wrapped_around = false; \
- if (++(coord).col >= term->cols) { \
+ if (++(coord).col >= term->cols) { \
(coord).row = ((coord).row + 1) & (grid->num_rows - 1); \
(coord).col = 0; \
- row = grid->rows[(coord).row]; \
+ row = grid->rows[(coord).row]; \
if (has_wrapped_around(term, (coord.row))) \
wrapped_around = true; \
} \
- wrapped_around; \
+ !wrapped_around; \
})
/* First character to consider is the *next* character */
- if (newline(new_end))
+ if (!advance_pos(new_end))
return;
xassert(grid->rows[new_end.row] != NULL);
@@ -641,7 +641,7 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
return;
do {
- if (newline(pos))
+ if (!advance_pos(pos))
break;
if (!extract_one(term, row, &row->cells[pos.col], pos.col, ctx))
break;
@@ -676,7 +676,7 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
term->search.match_len = term->search.len;
-#undef newline
+#undef advance_pos
}
static size_t