From 006c75d2d3bff050ec5cb40b73c02c7b35608549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 18 Apr 2022 14:57:31 +0200 Subject: [PATCH] =?UTF-8?q?search:=20rename=20=E2=80=98newline=E2=80=99=20?= =?UTF-8?q?->=20=E2=80=98advance=5Fpos=E2=80=99=20macro,=20reverse=20retur?= =?UTF-8?q?n=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search.c | 14 +++++++------- 1 file 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