fix bugs related to deleting ('dge' and 'dgE' motions should also delete the letter which the cursor is currently at, and now they do)
This commit is contained in:
@@ -152,6 +152,30 @@ struct
|
|||||||
deleteAndFinish (app, low, length, buffer, time)
|
deleteAndFinish (app, low, length, buffer, time)
|
||||||
end
|
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) =
|
fun deleteToEndOfLine (app: app_type, time) =
|
||||||
let
|
let
|
||||||
val {buffer, cursorIdx, ...} = app
|
val {buffer, cursorIdx, ...} = app
|
||||||
@@ -291,6 +315,8 @@ struct
|
|||||||
let
|
let
|
||||||
val {cursorIdx, buffer, windowWidth, windowHeight, searchString, ...} =
|
val {cursorIdx, buffer, windowWidth, windowHeight, searchString, ...} =
|
||||||
app
|
app
|
||||||
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
|
val cursorIdx = Cursor.viDlrForDelete (buffer, cursorIdx, 1)
|
||||||
|
|
||||||
val buffer = LineGap.delete (0, cursorIdx, buffer)
|
val buffer = LineGap.delete (0, cursorIdx, buffer)
|
||||||
|
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ struct
|
|||||||
|
|
||||||
fun parseDeleteGo (app, count, chrCmd, time) =
|
fun parseDeleteGo (app, count, chrCmd, time) =
|
||||||
case chrCmd of
|
case chrCmd of
|
||||||
#"e" => NormalDelete.deleteByDfa (app, count, Cursor.endOfPrevWord, time)
|
#"e" => NormalDelete.deleteToEndOfPrevWord (app, count, time)
|
||||||
| #"E" => NormalDelete.deleteByDfa (app, count, Cursor.endOfPrevWORD, time)
|
| #"E" => NormalDelete.deleteToEndOfPrevWORD (app, count, time)
|
||||||
| #"g" => NormalDelete.deleteToStart (app, time)
|
| #"g" => NormalDelete.deleteToStart (app, time)
|
||||||
| _ => NormalFinish.clearMode app
|
| _ => NormalFinish.clearMode app
|
||||||
|
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ struct
|
|||||||
fun yankToStart (app: app_type) =
|
fun yankToStart (app: app_type) =
|
||||||
let
|
let
|
||||||
val {cursorIdx, buffer, ...} = app
|
val {cursorIdx, buffer, ...} = app
|
||||||
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
|
|
||||||
val high = Cursor.viDlrForDelete (buffer, cursorIdx, 1)
|
val high = Cursor.viDlrForDelete (buffer, cursorIdx, 1)
|
||||||
val buffer = LineGap.goToIdx (high, buffer)
|
val buffer = LineGap.goToIdx (high, buffer)
|
||||||
|
|||||||
Reference in New Issue
Block a user