diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-05-06 19:43:12 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-05-07 16:26:14 +0100 |
| commit | 17b19dc057a33b3a2284e6366f1842822bc83c02 (patch) | |
| tree | 2627ee3f414bef159c8b9911a4e6d19dba8a466e /src | |
| parent | ff15f6bbaff698e3ad760bd5041f8f15b47f3a4b (diff) | |
Ensure window position line is inside buffer
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/window.cc b/src/window.cc index 21f3ed74..47a52fcf 100644 --- a/src/window.cc +++ b/src/window.cc @@ -185,9 +185,9 @@ void Window::compute_display_setup(const Context& context) // Ensure cursor line is visible if (cursor.line - offset.line < m_position.line) - m_position.line = cursor.line - offset.line; + m_position.line = std::max(0_line, cursor.line - offset.line); if (cursor.line + offset.line >= m_position.line + m_dimensions.line) - m_position.line = cursor.line + offset.line - m_dimensions.line + 1; + m_position.line = std::min(buffer().line_count()-1, cursor.line + offset.line - m_dimensions.line + 1); const int tabstop = context.options()["tabstop"].get<int>(); auto cursor_col = get_column(buffer(), tabstop, cursor); |
