summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-07-16 13:12:17 +0900
committerMaxime Coste <mawww@kakoune.org>2017-07-16 13:12:17 +0900
commita9455bf13259080233f1f2f13c034615363e532c (patch)
tree69914f6afea8eb4f74077db65f8911da0e9e0543 /src/input_handler.cc
parentc625080ecfab2bdb714ce287b26e4b5398e31ef7 (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.cc3
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};
}