Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd9f3de

Browse files
committed
[fsharpi]: add kill-to-end-of-line (control-k), fix control-p and control-n (F# uses decimals, not octals), and make control-d delete char when not at the end
1 parent6c3c810 commitcd9f3de

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

‎src/fsharp/fsi/console.fs‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ type ReadLineConsole() =
344344
input.Remove(!current,1)|> ignore;
345345
render();
346346

347+
letdeleteToEndOfLine()=
348+
if(!current< input.Length)then
349+
input.Remove(!current, input.Length-!current)|> ignore;
350+
render();
351+
347352
letinsert(key:ConsoleKeyInfo)=
348353
// REVIEW: is this F6 rewrite required? 0x1A looks like Ctrl-Z.
349354
// REVIEW: the Ctrl-Z code is not recognised as EOF by the lexer.
@@ -425,17 +430,25 @@ type ReadLineConsole() =
425430
|(ConsoleModifiers.Control, '\006')->
426431
moveRight()
427432
change()
433+
// Control-k delete to end of line
434+
|(ConsoleModifiers.Control, '\011')->
435+
deleteToEndOfLine()
436+
change()
428437
// Control-P
429-
|(ConsoleModifiers.Control, '\020')->
438+
|(ConsoleModifiers.Control, '\016')->
430439
setInput(history.Previous());
431440
change()
432441
// Control-n
433-
|(ConsoleModifiers.Control, '\016')->
442+
|(ConsoleModifiers.Control, '\014')->
434443
setInput(history.Next());
435444
change()
436445
// Control-d
437446
|(ConsoleModifiers.Control, '\004')->
438-
raise<|new System.IO.EndOfStreamException()
447+
if(input.Length=0)then
448+
raise<|new System.IO.EndOfStreamException()
449+
else
450+
delete();
451+
change()
439452
|_->
440453
// Note: If KeyChar=0, the not a proper char, e.g. it could be part of a multi key-press character,
441454
// e.g. e-acute is ' and e with the French (Belgium) IME and US Intl KB.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp