From 624399da9992b92f59daef4a79575c338e989e3e Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sun, 14 Mar 2021 15:53:20 -0400 Subject: fix find menu scroll bug, for real this time --- buffer.c | 8 +++----- find.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/buffer.c b/buffer.c index 4b3535c..c4143c9 100644 --- a/buffer.c +++ b/buffer.c @@ -2182,6 +2182,9 @@ bool buffer_handle_click(Ted *ted, TextBuffer *buffer, v2 click, u8 times) { } if (buffer_pixels_to_pos(buffer, click, &buffer_pos)) { // user clicked on buffer + if (!ted->menu || buffer->is_line_buffer) { + ted_switch_to_buffer(ted, buffer); + } if (buffer == ted->active_buffer) { switch (ted->key_modifier) { case KEY_MODIFIER_SHIFT: @@ -2217,11 +2220,6 @@ bool buffer_handle_click(Ted *ted, TextBuffer *buffer, v2 click, u8 times) { } return true; } - // better to do this after handing click, because some stuff called by ted_switch_to_buffer - // needs to know the correct cursor pos - if (!ted->menu || buffer->is_line_buffer) { - ted_switch_to_buffer(ted, buffer); - } } return false; } diff --git a/find.c b/find.c index 0587b61..d4a24c4 100644 --- a/find.c +++ b/find.c @@ -155,7 +155,7 @@ static void find_update(Ted *ted, bool force) { find_buffer->modified = false; if (best_scroll_candidate.line != U32_MAX) // scroll to first match (if there is one) buffer_scroll_to_pos(buffer, best_scroll_candidate); - } else { + } else if (find_buffer->modified) { buffer_scroll_to_cursor(buffer); } } -- cgit v1.2.3