Skip to content

Commit c649ebb

Browse files
authored
fix #39982, reduce cursor artifacts in REPL after #39538 (#40411)
1 parent c3c8ffa commit c649ebb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

stdlib/REPL/src/LineEdit.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,19 +790,23 @@ function edit_insert(s::PromptState, c::StringLike)
790790
offset = s.ias.curs_row == 1 || s.indent < 0 ?
791791
sizeof(prompt_string(s.p.prompt)::String) : s.indent
792792
offset += position(buf) - beginofline(buf) # size of current line
793+
spinner = true
793794
if offset + textwidth(str) <= w
794795
# Avoid full update when appending characters to the end
795796
# and an update of curs_row isn't necessary (conservatively estimated)
796797
write(termbuf, str)
798+
spinner = false
797799
elseif after == 0
798800
refresh_line(s)
799801
delayup = false
800802
else
801803
delayup = true
802804
end
803805
if delayup
804-
write(termbuf, spin_seq[mod1(position(buf) - w, length(spin_seq))])
805-
cmove_left(termbuf)
806+
if spinner
807+
write(termbuf, spin_seq[mod1(position(buf) - w, length(spin_seq))])
808+
cmove_left(termbuf)
809+
end
806810
s.refresh_wait = Timer(after) do t
807811
s.refresh_wait === t || return
808812
s.refresh_wait = nothing

stdlib/REPL/src/options.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Options(;
4646
auto_indent_tmp_off = false,
4747
auto_indent_bracketed_paste = false,
4848
auto_indent_time_threshold = 0.005,
49-
auto_refresh_time_delay = 0.05,
49+
auto_refresh_time_delay = Sys.iswindows() ? 0.05 : 0.0,
5050
iocontext = Dict{Symbol,Any}()) =
5151
Options(hascolor, extra_keymap, tabwidth,
5252
kill_ring_max, region_animation_duration,

0 commit comments

Comments
 (0)