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:
@@ -383,8 +383,17 @@ struct
|
|||||||
val low = Cursor.endOfPrevWord (buffer, cursorIdx, count)
|
val low = Cursor.endOfPrevWord (buffer, cursorIdx, count)
|
||||||
|
|
||||||
val length = (cursorIdx + 1) - low
|
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
|
in
|
||||||
deleteAndFinish (app, low, length, buffer, time)
|
finishAfterDeletingBuffer (app, newCursorIdx, buffer, time, initialMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun deleteToEndOfPrevWORD (app: app_type, count, time) =
|
fun deleteToEndOfPrevWORD (app: app_type, count, time) =
|
||||||
@@ -398,8 +407,17 @@ struct
|
|||||||
val low = Cursor.endOfPrevWORD (buffer, cursorIdx, count)
|
val low = Cursor.endOfPrevWORD (buffer, cursorIdx, count)
|
||||||
|
|
||||||
val length = (cursorIdx + 1) - low
|
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
|
in
|
||||||
deleteAndFinish (app, low, length, buffer, time)
|
finishAfterDeletingBuffer (app, newCursorIdx, buffer, time, initialMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun deleteToEndOfLine (app: app_type, time) =
|
fun deleteToEndOfLine (app: app_type, time) =
|
||||||
|
|||||||
@@ -2387,7 +2387,7 @@ struct
|
|||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val actualString = LineGap.toString buffer
|
val actualString = LineGap.toString buffer
|
||||||
val expectedString = "hell world\n"
|
val expectedString = "hell\n"
|
||||||
val expectedCursorIdx = String.size expectedString - 2
|
val expectedCursorIdx = String.size expectedString - 2
|
||||||
in
|
in
|
||||||
Expect.isTrue
|
Expect.isTrue
|
||||||
|
|||||||
Reference in New Issue
Block a user