tConsolidate code - ve - a minimal text editor (work in progress) | |
git clone git://src.adamsgaard.dk/ve | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8455a8714673d14e2e3b04e3072bab9bb26c7329 | |
parent eb81dcd6d14223042118a1d85ae90f4eaf2f53cf | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 7 Aug 2019 10:48:29 +0200 | |
Consolidate code | |
Diffstat: | |
M find.c | 14 ++++++++------ | |
1 file changed, 8 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/find.c b/find.c | |
t@@ -16,7 +16,7 @@ | |
void | |
editor_find_next_occurence(int opposite_direction) | |
{ | |
- int y, y_end, y_inc; | |
+ int y, y_end, y_inc, x_offset; | |
eRow *row; | |
char *match; | |
t@@ -32,17 +32,19 @@ editor_find_next_occurence(int opposite_direction) | |
y_inc = -1; | |
} | |
+ x_offset = 0; | |
/* from cursor until end of document */ | |
for (y = E.cursor_y; y != y_end; y += y_inc) { | |
row = &E.row[y]; | |
if (y == E.cursor_y) | |
- match = strstr(row->rchars + 1 + | |
- editor_row_cursor_x_to_rx(&E.row[E.cursor_y], | |
- E.cursor_x), | |
- E.find_query); | |
+ x_offset = y_inc + editor_row_cursor_x_to_rx(&E.row[E.… | |
+ E.cursor_x); | |
else | |
- match = strstr(row->rchars, E.find_query); | |
+ x_offset = 0; | |
+ | |
+ /* TODO: lines are not searched in reverse with opposite_direc… | |
+ match = strstr(row->rchars + x_offset, E.find_query); | |
if (match) | |
break; | |
} |