mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-08 08:20:59 -04:00
search: don't modify search.start coord *before* finding next match
The match logic uses the last start coordinate to determine which end points in the selection to update. This sometimes fails when the start coordinate has been changed by e.g. a key binding - the new start coordinate is incorrectly matched against the old-but-modified start coordinate, causing foot to e.g. *not* upate the selection start coordinate. Example: $ echo 'test\n\test\ntest' Then do a scrollback search for 'test. The first match is found correctly (the last 'test'), but searching for the previous match (ctrl+r) does not select the middle 'test'. Fix by passing the search direction to search_find_next(), and have _it_ calculate the coordinate to start search. There are three possibilities: * forward * backward * "backward", but at the same position The first two are used when searching for next/prev match with ctrl+s and ctrl+r. The last one is used when the search criteria is updated. In this case, we don't want to move to the previous match, *unless* the current match no longer matches.
This commit is contained in:
parent
dd03e10c6c
commit
9907d7bbe9
3 changed files with 73 additions and 55 deletions
|
|
@ -263,7 +263,7 @@ enum selection_kind {
|
|||
};
|
||||
enum selection_direction {SELECTION_UNDIR, SELECTION_LEFT, SELECTION_RIGHT};
|
||||
enum selection_scroll_direction {SELECTION_SCROLL_NOT, SELECTION_SCROLL_UP, SELECTION_SCROLL_DOWN};
|
||||
enum search_direction { SEARCH_BACKWARD, SEARCH_FORWARD};
|
||||
enum search_direction { SEARCH_BACKWARD_SAME_POSITION, SEARCH_BACKWARD, SEARCH_FORWARD };
|
||||
|
||||
struct ptmx_buffer {
|
||||
void *data;
|
||||
|
|
@ -503,7 +503,6 @@ struct terminal {
|
|||
size_t len;
|
||||
size_t sz;
|
||||
size_t cursor;
|
||||
enum search_direction direction;
|
||||
|
||||
int original_view;
|
||||
bool view_followed_offset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue