fix failing test for 'dge' motion: if the deletion takes us to a newliune that follows a non-newline-character, we should decrement the cursor to be on the non-newline-character

This commit is contained in:
2025-10-14 12:31:18 +01:00
parent d73959ce9b
commit 999a35cb8b
3 changed files with 22 additions and 4 deletions

View File

@@ -383,8 +383,17 @@ struct
val low = Cursor.endOfPrevWord (buffer, cursorIdx, count)
val length = (cursorIdx + 1) - low
val buffer = LineGap.goToIdx (cursorIdx + 1, buffer)
val initialMsg = Fn.initMsgs (low, length, buffer)
val buffer = LineGap.delete (low, length, buffer)
val buffer = LineGap.goToIdx (low, buffer)
val newCursorIdx =
if Cursor.isOnNewlineAfterChr (buffer, low) then Int.max (low - 1, 0)
else low
in
deleteAndFinish (app, low, length, buffer, time)
finishAfterDeletingBuffer (app, newCursorIdx, buffer, time, initialMsg)
end
fun deleteToEndOfPrevWORD (app: app_type, count, time) =
@@ -398,8 +407,17 @@ struct
val low = Cursor.endOfPrevWORD (buffer, cursorIdx, count)
val length = (cursorIdx + 1) - low
val buffer = LineGap.goToIdx (cursorIdx + 1, buffer)
val initialMsg = Fn.initMsgs (low, length, buffer)
val buffer = LineGap.delete (low, length, buffer)
val buffer = LineGap.goToIdx (low, buffer)
val newCursorIdx =
if Cursor.isOnNewlineAfterChr (buffer, low) then Int.max (low - 1, 0)
else low
in
deleteAndFinish (app, low, length, buffer, time)
finishAfterDeletingBuffer (app, newCursorIdx, buffer, time, initialMsg)
end
fun deleteToEndOfLine (app: app_type, time) =

View File

@@ -1 +1 @@
hello world again
hello world

View File

@@ -2387,7 +2387,7 @@ struct
(* assert *)
val actualString = LineGap.toString buffer
val expectedString = "hell world\n"
val expectedString = "hell\n"
val expectedCursorIdx = String.size expectedString - 2
in
Expect.isTrue