summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 5 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;
}