Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #39982, reduce cursor artifacts in REPL after #39538 #40411

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -790,19 +790,23 @@ function edit_insert(s::PromptState, c::StringLike)
offset = s.ias.curs_row == 1 || s.indent < 0 ?
sizeof(prompt_string(s.p.prompt)::String) : s.indent
offset += position(buf) - beginofline(buf) # size of current line
spinner = true
if offset + textwidth(str) <= w
# Avoid full update when appending characters to the end
# and an update of curs_row isn't necessary (conservatively estimated)
write(termbuf, str)
spinner = false
elseif after == 0
refresh_line(s)
delayup = false
else
delayup = true
end
if delayup
write(termbuf, spin_seq[mod1(position(buf) - w, length(spin_seq))])
cmove_left(termbuf)
if spinner
write(termbuf, spin_seq[mod1(position(buf) - w, length(spin_seq))])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now that str[end] may be a better choice than spin_seq[*] also. But would need to test that theory.

cmove_left(termbuf)
end
s.refresh_wait = Timer(after) do t
s.refresh_wait === t || return
s.refresh_wait = nothing
Expand Down
2 changes: 1 addition & 1 deletion stdlib/REPL/src/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Options(;
auto_indent_tmp_off = false,
auto_indent_bracketed_paste = false,
auto_indent_time_threshold = 0.005,
auto_refresh_time_delay = 0.05,
auto_refresh_time_delay = Sys.iswindows() ? 0.05 : 0.0,
iocontext = Dict{Symbol,Any}()) =
Options(hascolor, extra_keymap, tabwidth,
kill_ring_max, region_animation_duration,
Expand Down