diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-08-27 08:05:46 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-09-02 12:55:57 +1000 |
| commit | 20a2bca52e0d159cdbab4ff6d38024cd1503a4f5 (patch) | |
| tree | a019bb44362357ddf4ca8db4a17c576528825100 /src/normal.cc | |
| parent | 699027000551f04ce9f3e532d20c6e484ca7a945 (diff) | |
Do not make cursor visible after mouse scrolling and view commands
ensure cursor is visible after user input except if the command
implementation opted-out. Hooks and timers should not enforce
visible cursor.
PageUp/PageDown and `<c-f>` / `<c-b>` commands still move the cursor
as this seemed a desired behaviour.
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/normal.cc b/src/normal.cc index 79a434ac..81caeb2d 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -368,6 +368,7 @@ void view_commands(Context& context, NormalParams params) const int count = params.count; on_next_key_with_autoinfo(context, "view", KeymapMode::View, [count](Key key, Context& context) { + context.ensure_cursor_visible = false; if (key == Key::Escape) return; @@ -400,10 +401,10 @@ void view_commands(Context& context, NormalParams params) window.scroll(-std::max<ColumnCount>(1, count)); break; case 'j': - scroll_window(context, std::max<LineCount>(1, count)); + scroll_window(context, std::max<LineCount>(1, count), OnHiddenCursor::PreserveSelections); break; case 'k': - scroll_window(context, -std::max<LineCount>(1, count)); + scroll_window(context, -std::max<LineCount>(1, count), OnHiddenCursor::PreserveSelections); break; case 'l': window.scroll( std::max<ColumnCount>(1, count)); @@ -1408,7 +1409,7 @@ void scroll(Context& context, NormalParams params) const int count = params.count ? params.count : 1; const LineCount offset = (window.dimensions().line - 2) / (half ? 2 : 1) * count; - scroll_window(context, offset * direction); + scroll_window(context, offset * direction, OnHiddenCursor::MoveCursorAndAnchor); } template<Direction direction> |
