amand MakeNormalDelete.removeChr function (which is used by 'x' and 'dh' commands) to pass test, which checks that cursorIdx does not fall on newline-after-chr after deletion

This commit is contained in:
2025-09-24 09:02:33 +01:00
parent c500704f04
commit 95393e1e13

View File

@@ -62,9 +62,12 @@ struct
val lineEndAfterDelete = Cursor.viDlr (buffer, lineStart, 1)
val cursorIdx = Int.min (lineEndAfterDelete, cursorIdx)
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val cursorIdx =
if cursorIdx >= #textLength buffer - 2 then
Int.max (0, #textLength buffer - 2)
if Cursor.isOnNewlineAfterChr (buffer, cursorIdx) then
if cursorIdx < #textLength buffer - 1 then cursorIdx + 1
else cursorIdx - 1
else
cursorIdx
in