add separate folder when deleting end of current word, so that we can fix 'de' and 'dE' motions (the result of the folders for the cursor motion is meant to be decremented by 1, but the result for deleting is not meant to be decremented or incremented at all)

This commit is contained in:
2025-08-03 17:35:33 +01:00
parent 0f3b6a39fb
commit e55a7e2bca
4 changed files with 48 additions and 15 deletions

View File

@@ -123,6 +123,25 @@ struct
val fStart = EndOfCurrentWORDFolder.foldNext
end)
structure EndOfCurrentWORDForDelete =
MakeNextDfaLoopPlus1
(struct
val startState = startState
structure Folder =
MakeCharFolderNext
(struct
val startState = startState
val tables = tables
fun isFinal currentState =
currentState = spaceAfterNonBlankState
fun finish idx = idx
end)
val fStart = Folder.foldNext
end)
structure EndOfCurrentWORDStrict =
MakeNextDfaLoop
(struct
@@ -138,6 +157,7 @@ struct
val startOfCurrentWORD = StartOfCurrentWORD.prev
(* E *)
val endOfCurrentWORD = EndOfCurrentWORD.next
val endOfCurrentWORDForDelete = EndOfCurrentWORDForDelete.next
(* functions to strictly get the start and end of the current word.
* Problem: We want to support Vi motions like viW (selects a single word),