diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-07-16 13:12:17 +0900 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-07-16 13:12:17 +0900 |
| commit | a9455bf13259080233f1f2f13c034615363e532c (patch) | |
| tree | 69914f6afea8eb4f74077db65f8911da0e9e0543 /src/input_handler.cc | |
| parent | c625080ecfab2bdb714ce287b26e4b5398e31ef7 (diff) | |
Tolerate that the cursor might not be visible
Sometimes, like if the window is not high enough, we might not be
able to display any buffer lines, hence not have the cursor visible.
Fixes #1502
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 666a36cf..63c69eed 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -41,7 +41,8 @@ public: virtual std::pair<CursorMode, DisplayCoord> get_cursor_info() const { - DisplayCoord coord = *context().window().display_position(context().selections().main().cursor()); + const auto cursor = context().selections().main().cursor(); + auto coord = context().window().display_position(cursor).value_or(DisplayCoord{}); return {CursorMode::Buffer, coord}; } |
