1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-21 02:21:32 +03:00

Ensure window position line is inside buffer

This commit is contained in:
Maxime Coste 2017-05-06 19:43:12 +01:00
parent ff15f6bbaf
commit 17b19dc057

View File

@ -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);