Skip to content

Commit

Permalink
expand comments
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 12, 2023
1 parent 7c9f75d commit de9a705
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de9a705

Please sign in to comment.