Skip to content

Commit

Permalink
Unmark text while not moving ahead at the end
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Code7R committed Oct 20, 2024
1 parent bf8f57c commit 95d8f55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/yinputline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 95d8f55

Please sign in to comment.