From 95d8f55c59c75017184f9c555ff44e9cd5462284 Mon Sep 17 00:00:00 2001 From: Eduard Bloch Date: Sun, 20 Oct 2024 20:14:30 +0200 Subject: [PATCH] Unmark text while not moving ahead at the end Make the marked area behave like on a typical terminal where pressing right-arrow can be used to get rid of marked line while not doing anything if the cursor was at the end already. --- src/yinputline.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/yinputline.cc b/src/yinputline.cc index c66140c4d..26da8388c 100644 --- a/src/yinputline.cc +++ b/src/yinputline.cc @@ -270,8 +270,10 @@ bool YInputLine::handleKey(const XKeyEvent &key) { return true; } } else { - if (curPos < textLen) { - if (move(curPos + 1, extend)) + if (curPos <= textLen) { + // advance cursor unless at EOL, where the move is a + // no-op BUT it would remove the unwanted text marking + if (move(curPos + (curPos < textLen), extend)) return true; } }