add function to yank inside WORD
This commit is contained in:
@@ -624,6 +624,7 @@ struct
|
||||
(* equivalent of vi's `E` command *)
|
||||
val endOfWORD = ViCapsWordDfa.endOfCurrentWORD
|
||||
val endOfWORDForDelete = ViCapsWordDfa.endOfCurrentWORDForDelete
|
||||
val endOfWORDStrict = ViCapsWordDfa.endOfCurrentWORDStrict
|
||||
|
||||
(* Prerequisite:
|
||||
* LineGap has been moved to start of line (provided with vi0). *)
|
||||
|
||||
@@ -296,8 +296,8 @@ struct
|
||||
fun parseYankInside (app, chr) =
|
||||
case chr of
|
||||
#"w" => NormalYank.yankInsideWord app
|
||||
| #"W" => NormalYank.yankInsideWORD app
|
||||
(*
|
||||
| #"W" => NormalDelete.deleteInsideWORD app
|
||||
| #"(" => NormalDelete.deleteInsideChrOpen (app, chr)
|
||||
| #"[" => NormalDelete.deleteInsideChrOpen (app, chr)
|
||||
| #"{" => NormalDelete.deleteInsideChrOpen (app, chr)
|
||||
|
||||
@@ -269,6 +269,25 @@ struct
|
||||
val buffer = LineGap.goToIdx (high, buffer)
|
||||
val length = high - low
|
||||
|
||||
val str = LineGap.substring (low, length, buffer)
|
||||
val msg = YANK str
|
||||
val mode = NORMAL_MODE ""
|
||||
in
|
||||
if str = "\n" then app
|
||||
else NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
|
||||
end
|
||||
|
||||
fun yankInsideWORD (app: app_type) =
|
||||
let
|
||||
val {buffer, cursorIdx, searchString, ...} = app
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val low = Cursor.prevWORDStrict (buffer, cursorIdx, 1)
|
||||
val high = Cursor.endOfWORDStrict (buffer, cursorIdx, 1)
|
||||
|
||||
val high = high + 1
|
||||
val buffer = LineGap.goToIdx (high, buffer)
|
||||
val length = high - low
|
||||
|
||||
val str = LineGap.substring (low, length, buffer)
|
||||
val msg = YANK str
|
||||
val mode = NORMAL_MODE ""
|
||||
|
||||
Reference in New Issue
Block a user