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
This commit is contained in:
Maxime Coste 2017-07-16 13:12:17 +09:00
parent c625080ecf
commit a9455bf132

View File

@ -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};
}