File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import (
2323)
2424
2525var (
26- ErrCtrlC = errors .New ("ctrl + C" )
2726 ErrCtrlD = errors .New ("ctrl + D" )
2827)
2928
@@ -497,9 +496,6 @@ func (t *Terminal) Run() error {
497496 //This will break if the user does CTRL+D apparently we need to reset the whole terminal if a user does this.... so just exit instead
498497 line , err := t .ReadLine ()
499498 if err != nil {
500- if err == ErrCtrlC {
501- continue
502- }
503499 return err
504500 }
505501
@@ -926,6 +922,12 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) {
926922 t .cursorX , t .cursorY = 0 , 0
927923 t .advanceCursor (visualLength (t .prompt ))
928924 t .setLine (t .line , t .pos )
925+ case keyCtrlC :
926+ t .queue ([]rune ("^C\r \n " ))
927+ t .queue (t .prompt )
928+ t .cursorX = 0
929+ t .advanceCursor (visualLength (t .prompt ))
930+ t .setLine ([]rune {}, 0 )
929931 default :
930932 if t .AutoCompleteCallback != nil {
931933 prefix := string (t .line [:t .pos ])
@@ -1125,10 +1127,6 @@ func (t *Terminal) readLine() (line string, err error) {
11251127 return "" , ErrCtrlD
11261128 }
11271129 }
1128- if key == keyCtrlC {
1129- t .remainder = nil
1130- return "" , ErrCtrlC
1131- }
11321130 if key == keyPasteStart {
11331131 t .pasteActive = true
11341132 if len (t .line ) == 0 {
You can’t perform that action at this time.
0 commit comments