@@ -336,6 +336,27 @@ type internal ReadLineConsole() =
336336 if ( input.Length > 0 && current < input.Length) then
337337 input.Remove( current, 1 ) |> ignore
338338 render()
339+
340+ let deleteFromStartOfLineToCursor () =
341+ if ( input.Length > 0 && current > 0 ) then
342+ input.Remove ( 0 , current) |> ignore
343+ current <- 0
344+ render()
345+
346+ let deleteWordLeadingToCursor () =
347+ if ( input.Length > 0 && current > 0 ) then
348+ let line = input.ToString()
349+ let rec prevWord ( idx , isInWord ) =
350+ if idx < 0 then 0 else
351+ match line.Chars( idx), isInWord with
352+ | ' ' , true -> idx + 1
353+ | ' ' , false -> prevWord ( idx - 1 , false )
354+ | _, _ -> prevWord ( idx - 1 , true )
355+
356+ let idx = prevWord ( current - 1 , false )
357+ input.Remove( idx, current - idx) |> ignore
358+ current <- idx
359+ render()
339360
340361 let deleteToEndOfLine () =
341362 if ( current < input.Length) then
@@ -452,6 +473,12 @@ type internal ReadLineConsole() =
452473 | ( ConsoleModifiers.Control, ConsoleKey.L) ->
453474 clear()
454475 change()
476+ | ( ConsoleModifiers.Control, ConsoleKey.U) ->
477+ deleteFromStartOfLineToCursor()
478+ change()
479+ | ( ConsoleModifiers.Control, ConsoleKey.W) ->
480+ deleteWordLeadingToCursor()
481+ change()
455482 | _ ->
456483 // Note: If KeyChar=0, the not a proper char, e.g. it could be part of a multi key-press character,
457484 // e.g. e-acute is ' and e with the French (Belgium) IME and US Intl KB.
0 commit comments