diff --git a/base/repl/LineEdit.jl b/base/repl/LineEdit.jl index 448f607828972..0a072bfd8fc59 100644 --- a/base/repl/LineEdit.jl +++ b/base/repl/LineEdit.jl @@ -2023,16 +2023,19 @@ AnyDict( "^W" => (s,o...)->edit_werase(s), # Meta D "\ed" => (s,o...)->edit_delete_next_word(s), - "^C" => (s,o...)->begin - try # raise the debugger if present - ccall(:jl_raise_debugger, Int, ()) + "^C" => function (s,o...) + if isempty(s) + try # raise the debugger if present + ccall(:jl_raise_debugger, Int, ()) + end + cancel_beep(s) + refresh_line(s) + print(terminal(s), "^C\n\n") + transition(s, :reset) + refresh_line(s) + else + edit_clear(s) end - cancel_beep(s) - move_input_end(s) - refresh_line(s) - print(terminal(s), "^C\n\n") - transition(s, :reset) - refresh_line(s) end, "^Z" => (s,o...)->(return :suspend), # Right Arrow diff --git a/base/repl/REPL.jl b/base/repl/REPL.jl index 3396777cd0a08..c291bd7de8ca4 100644 --- a/base/repl/REPL.jl +++ b/base/repl/REPL.jl @@ -732,12 +732,14 @@ function mode_keymap(julia_prompt::Prompt) end end, "^C" => function (s,o...) - LineEdit.move_input_end(s) - LineEdit.refresh_line(s) - print(LineEdit.terminal(s), "^C\n\n") - transition(s, julia_prompt) - transition(s, :reset) - LineEdit.refresh_line(s) + if isempty(s) + print(LineEdit.terminal(s), "^C\n\n") + transition(s, julia_prompt) + transition(s, :reset) + LineEdit.refresh_line(s) + else + LineEdit.edit_clear(s) + end end) end