From de9a705d82adbec56a5859f9e17e74b580c09a18 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Tue, 12 Sep 2023 05:33:55 -0400 Subject: [PATCH] expand comments --- stdlib/REPL/src/LineEdit.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index 2306d4d2e1f60..0b2b34dd1c16e 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -458,13 +458,15 @@ prompt_string(f::Function) = Base.invokelatest(f) function maybe_show_hint(s::PromptState) isa(s.hint, String) || return nothing + # The hint being "" then nothing is used to first clear a previous hint, then skip printing the hint + # the clear line cannot be printed each time because it breaks column movement if isempty(s.hint) - print(terminal(s), "\e[0K") + print(terminal(s), "\e[0K") # clear remainder of line which had a hint s.hint = nothing else Base.printstyled(terminal(s), s.hint, color=:light_black) cmove_left(terminal(s), textwidth(s.hint)) - s.hint = "" # clear line remainder of line but only once after a hint to allow column movement + s.hint = "" # being "" signals to do one clear line remainder to clear the hint next time if still empty end return nothing end