diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-05-19 10:46:23 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-05-19 14:15:16 +1000 |
| commit | c9a8658671fd3f985bae9eaeddba8d2b9205573a (patch) | |
| tree | e799bb0c747d838cdb22f2e9a4fee777492b4efc /src/window.cc | |
| parent | a64afd7f1a92a55572d3d63d2c45ab86da6a51b0 (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.cc | 10 |
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; |
