From 5a0332ac87dcdab1f811d99599fac58cbc548272 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 24 Nov 2017 16:36:37 +0800 Subject: [PATCH] Window: fix buffer_coord when a line buffer range is empty Fixes #1711 --- src/window.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/window.cc b/src/window.cc index 76cb10cb..3e6ba661 100644 --- a/src/window.cc +++ b/src/window.cc @@ -260,7 +260,8 @@ BufferCoord find_buffer_coord(const DisplayLine& line, const Buffer& buffer, } column -= len; } - return buffer.clamp(buffer.prev(range.end)); + return range.end == BufferCoord{0,0} ? + range.end : buffer.prev(range.end); } }