From a9455bf13259080233f1f2f13c034615363e532c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 16 Jul 2017 13:12:17 +0900 Subject: [PATCH] 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 --- src/input_handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 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}; }