add function to yank inside WORD

This commit is contained in:
2025-09-06 01:15:45 +01:00
parent 73ec4e7578
commit 58e74afffb
4 changed files with 562 additions and 1 deletions

View File

@@ -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)

View File

@@ -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 ""