summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-07-05 10:13:57 +1000
committerMaxime Coste <mawww@kakoune.org>2020-07-05 10:13:57 +1000
commit8abf18209ee9cc7579d7eaa61dbe57f07922f1fd (patch)
tree7d86f655836dbe7c57e898a40036841fce5d87fd /src/input_handler.cc
parentf2cc7bc891922ad48c4372c0b69239ef74bce004 (diff)
Fix selections getting unsorted on scroll
Fixes #3478
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index f13c513e..36425eff 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1754,7 +1754,8 @@ void scroll_window(Context& context, LineCount offset, bool mouse_dragging)
win_pos.line = clamp(win_pos.line + offset, 0_line, line_count-1);
- Selection& main_selection = context.selections().main();
+ SelectionList& selections = context.selections();
+ Selection& main_selection = selections.main();
const BufferCoord anchor = main_selection.anchor();
const BufferCoord cursor = main_selection.cursor();
@@ -1775,6 +1776,8 @@ void scroll_window(Context& context, LineCount offset, bool mouse_dragging)
window.set_position(win_pos);
main_selection = { new_anchor, new_cursor };
+
+ selections.sort_and_merge_overlapping();
}
}