diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-09-16 07:25:02 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-09-16 07:25:02 +0100 |
| commit | 88fa43988acc2389d92ead46a41ff8c7f0608c1a (patch) | |
| tree | 39766d41fa447f9c7c832a4d567a55febd780775 /src/window.cc | |
| parent | daa7e37ed1a0794cf16fca23ece43d5151c8207a (diff) | |
Do not return beginning of buffer whenever display to buffer coord fails
Use an empty Optional to show that resolution failed and just do not
do anything in the mouse event handler in that case.
Diffstat (limited to 'src/window.cc')
| -rw-r--r-- | src/window.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/window.cc b/src/window.cc index c5fc44db..6db3a21a 100644 --- a/src/window.cc +++ b/src/window.cc @@ -312,13 +312,13 @@ Optional<DisplayCoord> Window::display_position(BufferCoord coord) const return {}; } -BufferCoord Window::buffer_coord(DisplayCoord coord) const +Optional<BufferCoord> Window::buffer_coord(DisplayCoord coord) const { if (m_display_buffer.timestamp() != buffer().timestamp() or m_display_buffer.lines().empty()) - return {0, 0}; + return {}; if (coord <= 0_line) - coord = {0,0}; + coord = {}; if ((size_t)coord.line >= m_display_buffer.lines().size()) coord = DisplayCoord{(int)m_display_buffer.lines().size()-1, INT_MAX}; |
