From 0d2d32d1a1090ce4c86510be8b10dc65ea1c0d62 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sun, 14 Mar 2021 15:38:24 -0400 Subject: fix weird scrolling with find menu open --- buffer.c | 8 +++++--- main.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/buffer.c b/buffer.c index 06f2960..baa553f 100644 --- a/buffer.c +++ b/buffer.c @@ -2160,9 +2160,6 @@ 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: @@ -2198,6 +2195,11 @@ 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/main.c b/main.c index 3bfd5f0..d6da080 100644 --- a/main.c +++ b/main.c @@ -1,3 +1,5 @@ +// @TODO: +// fix cursor pos in buffer_delete_chars_at_pos (try dedenting something -- the cursor moves) #include "base.h" no_warn_start #if _WIN32 -- cgit v1.2.3