summaryrefslogtreecommitdiff
path: root/src/window.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-11-01 17:23:53 +1100
committerMaxime Coste <mawww@kakoune.org>2023-11-01 17:24:54 +1100
commit8cc4de5bb376133311ab92338ec8decc5ea25ac2 (patch)
treead77e15e6fe5086f7edf2aab3bd976d706851017 /src/window.cc
parent2fa55be40a787be71f4360fd4e36b7a790c74fa6 (diff)
Always ensure we do not scroll past the last line
An assert fails from time to time after reloading fifo buffers due to being scrolled past the last line of the buffer. A repro case was not found but this should fix the underlying issue.
Diffstat (limited to 'src/window.cc')
-rw-r--r--src/window.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/window.cc b/src/window.cc
index 41e34767..1f444211 100644
--- a/src/window.cc
+++ b/src/window.cc
@@ -209,8 +209,9 @@ DisplaySetup Window::compute_display_setup(const Context& context) const
if (cursor.line - offset.line < win_pos.line)
win_pos.line = std::max(0_line, cursor.line - offset.line);
if (cursor.line + offset.line >= win_pos.line + m_dimensions.line)
- win_pos.line = std::min(buffer().line_count()-1, cursor.line + offset.line - m_dimensions.line + 1);
+ win_pos.line = cursor.line + offset.line - m_dimensions.line + 1;
}
+ win_pos.line = std::min(win_pos.line, buffer().line_count()-1);
DisplaySetup setup{
win_pos.line,