summaryrefslogtreecommitdiff
path: root/src/highlighters.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-08-27 08:05:46 +1000
committerMaxime Coste <mawww@kakoune.org>2023-09-02 12:55:57 +1000
commit20a2bca52e0d159cdbab4ff6d38024cd1503a4f5 (patch)
treea019bb44362357ddf4ca8db4a17c576528825100 /src/highlighters.cc
parent699027000551f04ce9f3e532d20c6e484ca7a945 (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/highlighters.cc')
-rw-r--r--src/highlighters.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc
index 6f6d6e30..954f1417 100644
--- a/src/highlighters.cc
+++ b/src/highlighters.cc
@@ -752,7 +752,8 @@ struct WrapHighlighter : Highlighter
win_line += wrap_count + 1;
// scroll window to keep cursor visible, and update range as lines gets removed
- while (buf_line >= cursor.line and setup.first_line < cursor.line and
+ while (setup.ensure_cursor_visible and
+ buf_line >= cursor.line and setup.first_line < cursor.line and
setup.cursor_pos.line + setup.scroll_offset.line >= win_height)
{
auto remove_count = 1 + line_wrap_count(setup.first_line, indent);
@@ -1660,7 +1661,8 @@ private:
setup.cursor_pos.column += cursor_move;
}
- if (last.line >= setup.first_line and
+ if (setup.ensure_cursor_visible and
+ last.line >= setup.first_line and
range.first.line <= setup.first_line + setup.line_count and
range.first.line != last.line)
{