summaryrefslogtreecommitdiff
path: root/src/window.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-05-19 10:46:23 +1000
committerMaxime Coste <mawww@kakoune.org>2018-05-19 14:15:16 +1000
commitc9a8658671fd3f985bae9eaeddba8d2b9205573a (patch)
treee799bb0c747d838cdb22f2e9a4fee777492b4efc /src/window.cc
parenta64afd7f1a92a55572d3d63d2c45ab86da6a51b0 (diff)
Fix assert with window small enough so that no part of buffer is displayed
Fixes #2056
Diffstat (limited to 'src/window.cc')
-rw-r--r--src/window.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/window.cc b/src/window.cc
index a57e7426..43ee52db 100644
--- a/src/window.cc
+++ b/src/window.cc
@@ -190,6 +190,14 @@ void Window::set_dimensions(DisplayCoord dimensions)
}
}
+static void check_display_setup(const DisplaySetup& setup, const Window& window)
+{
+ kak_assert(setup.window_pos.line >= 0 and setup.window_pos.line < window.buffer().line_count());
+ kak_assert(setup.window_pos.column >= 0);
+ kak_assert(setup.window_range.column >= 0);
+ kak_assert(setup.window_range.line >= 0);
+}
+
DisplaySetup Window::compute_display_setup(const Context& context) const
{
auto win_pos = m_position;
@@ -217,6 +225,7 @@ DisplaySetup Window::compute_display_setup(const Context& context) const
};
for (auto pass : { HighlightPass::Move, HighlightPass::Wrap })
m_builtin_highlighters.compute_display_setup({context, pass, {}}, setup);
+ check_display_setup(setup, *this);
// now ensure the cursor column is visible
{
@@ -233,6 +242,7 @@ DisplaySetup Window::compute_display_setup(const Context& context) const
setup.window_pos.column += overflow;
setup.cursor_pos.column -= overflow;
}
+ check_display_setup(setup, *this);
}
return setup;