diff --git a/fcore/normal-mode/normal-delete.sml b/fcore/normal-mode/normal-delete.sml index 49486d1..9936e35 100644 --- a/fcore/normal-mode/normal-delete.sml +++ b/fcore/normal-mode/normal-delete.sml @@ -152,6 +152,30 @@ struct deleteAndFinish (app, low, length, buffer, time) end + fun deleteToEndOfPrevWord (app: app_type, count, time) = + let + val {buffer, cursorIdx, searchString, ...} = app + + val buffer = LineGap.goToIdx (cursorIdx, buffer) + val low = Cursor.endOfPrevWord (buffer, cursorIdx, count) + + val length = (cursorIdx + 1) - low + in + deleteAndFinish (app, low, length, buffer, time) + end + + fun deleteToEndOfPrevWORD (app: app_type, count, time) = + let + val {buffer, cursorIdx, searchString, ...} = app + + val buffer = LineGap.goToIdx (cursorIdx, buffer) + val low = Cursor.endOfPrevWORD (buffer, cursorIdx, count) + + val length = (cursorIdx + 1) - low + in + deleteAndFinish (app, low, length, buffer, time) + end + fun deleteToEndOfLine (app: app_type, time) = let val {buffer, cursorIdx, ...} = app @@ -291,6 +315,8 @@ struct let val {cursorIdx, buffer, windowWidth, windowHeight, searchString, ...} = app + val buffer = LineGap.goToIdx (cursorIdx, buffer) + val cursorIdx = Cursor.viDlrForDelete (buffer, cursorIdx, 1) val buffer = LineGap.delete (0, cursorIdx, buffer) diff --git a/fcore/normal-mode/normal-mode.sml b/fcore/normal-mode/normal-mode.sml index 6bd9500..8e34a87 100644 --- a/fcore/normal-mode/normal-mode.sml +++ b/fcore/normal-mode/normal-mode.sml @@ -172,8 +172,8 @@ struct fun parseDeleteGo (app, count, chrCmd, time) = case chrCmd of - #"e" => NormalDelete.deleteByDfa (app, count, Cursor.endOfPrevWord, time) - | #"E" => NormalDelete.deleteByDfa (app, count, Cursor.endOfPrevWORD, time) + #"e" => NormalDelete.deleteToEndOfPrevWord (app, count, time) + | #"E" => NormalDelete.deleteToEndOfPrevWORD (app, count, time) | #"g" => NormalDelete.deleteToStart (app, time) | _ => NormalFinish.clearMode app diff --git a/fcore/normal-mode/normal-yank.sml b/fcore/normal-mode/normal-yank.sml index 4b79f0d..2986530 100644 --- a/fcore/normal-mode/normal-yank.sml +++ b/fcore/normal-mode/normal-yank.sml @@ -246,6 +246,7 @@ struct fun yankToStart (app: app_type) = let val {cursorIdx, buffer, ...} = app + val buffer = LineGap.goToIdx (cursorIdx, buffer) val high = Cursor.viDlrForDelete (buffer, cursorIdx, 1) val buffer = LineGap.goToIdx (high, buffer)