implement additional non-terminal yank commands
This commit is contained in:
@@ -280,7 +280,18 @@ struct
|
|||||||
parseYankTerminal (str, count, app, chrCmd, time)
|
parseYankTerminal (str, count, app, chrCmd, time)
|
||||||
else
|
else
|
||||||
(* todo: handle non-terminal characters *)
|
(* todo: handle non-terminal characters *)
|
||||||
app
|
case String.sub (str, strPos + 1) of
|
||||||
|
#"t" => NormalYank.yankToChr (app, 1, Cursor.tillNextChr, op+, chrCmd)
|
||||||
|
| #"T" => NormalYank.yankToChr (app, 1, Cursor.tillPrevChr, op-, chrCmd)
|
||||||
|
| #"f" => NormalYank.yankToChr (app, count, Cursor.toNextChr, op+, chrCmd)
|
||||||
|
| #"F" => NormalYank.yankToChr (app, count, Cursor.toPrevChr, op-, chrCmd)
|
||||||
|
(* todo: implement
|
||||||
|
| #"g" =>
|
||||||
|
| #"i" =>
|
||||||
|
| #"a" =>
|
||||||
|
| #"d" =>
|
||||||
|
*)
|
||||||
|
| _ => NormalFinish.clearMode app
|
||||||
|
|
||||||
(* useful reference as list of non-terminal commands *)
|
(* useful reference as list of non-terminal commands *)
|
||||||
fun parseAfterCount (strPos, str, count, app, chrCmd, time) =
|
fun parseAfterCount (strPos, str, count, app, chrCmd, time) =
|
||||||
|
|||||||
@@ -188,4 +188,42 @@ struct
|
|||||||
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
|
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun helpYankToChr
|
||||||
|
(app: app_type, buffer, cursorIdx, otherIdx, count, fMove, fInc, chr) =
|
||||||
|
if count = 0 then
|
||||||
|
let
|
||||||
|
val low = Int.min (cursorIdx, otherIdx)
|
||||||
|
val high = Int.max (cursorIdx, otherIdx)
|
||||||
|
val length = high - low
|
||||||
|
|
||||||
|
val buffer = LineGap.goToIdx (high, buffer)
|
||||||
|
val str = LineGap.substring (low, length, buffer)
|
||||||
|
val msg = YANK str
|
||||||
|
val mode = NORMAL_MODE ""
|
||||||
|
in
|
||||||
|
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val buffer = LineGap.goToIdx (otherIdx, buffer)
|
||||||
|
val newOtherIdx = fMove (buffer, otherIdx, chr)
|
||||||
|
val newCount = if newOtherIdx = otherIdx then 0 else count - 1
|
||||||
|
val newOtherIdx = fInc (newOtherIdx, 1)
|
||||||
|
in
|
||||||
|
helpYankToChr
|
||||||
|
(app, buffer, cursorIdx, newOtherIdx, newCount, fMove, fInc, chr)
|
||||||
|
end
|
||||||
|
|
||||||
|
fun yankToChr (app: app_type, count, fMove, fInc, chr) =
|
||||||
|
helpYankToChr
|
||||||
|
( app
|
||||||
|
, #buffer app
|
||||||
|
, #cursorIdx app
|
||||||
|
, #cursorIdx app
|
||||||
|
, count
|
||||||
|
, fMove
|
||||||
|
, fInc
|
||||||
|
, chr
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user