From 5a895202740963971423ee27d5c0f77a4a3f84cc Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 5 Jan 2020 15:16:40 +0100 Subject: render: ensure cursor is always visible in the search box Maintain a view 'offset' (which glyph from the search string to start rendering at). This defines the start of the viewable area. The end is the offset + the search box size (which is limited to the window size). Adjust this offset whenever the cursor moves outside the viewable area. For now, this is always done in the same way: set the offset to the cursor position. This means that when we're entering text at the end of the search criteria (i.e. the normal case; we're simply typing), and the search box reaches the window size, the cursor will jump to the start of the search box, which will be empty. This could be confusing, but let's go with for now. --- search.c | 1 + 1 file changed, 1 insertion(+) (limited to 'search.c') diff --git a/search.c b/search.c index 6eef411c..408c08bd 100644 --- a/search.c +++ b/search.c @@ -51,6 +51,7 @@ search_cancel_keep_selection(struct terminal *term) term->search.match = (struct coord){-1, -1}; term->search.match_len = 0; term->is_searching = false; + term->render.search_offset = 0; term_xcursor_update(term); render_refresh(term); -- cgit v1.3