Skip to content

Commit 0b331c7

Browse files
authored
Merge pull request #36453 from JuliaLang/teh/REPL_inference
Eliminate more REPL invalidations
2 parents a5af123 + 259ff82 commit 0b331c7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

stdlib/REPL/src/LineEdit.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ end
107107
# the default mark is 0
108108
getmark(s) = max(0, buffer(s).mark)
109109

110-
const Region = Pair{<:Integer,<:Integer}
110+
const Region = Pair{Int,Int}
111111

112112
_region(s) = getmark(s) => position(s)
113113
region(s) = Pair(extrema(_region(s))...)
@@ -201,7 +201,7 @@ end
201201
beep(::ModeState) = nothing
202202
cancel_beep(::ModeState) = nothing
203203

204-
for f in [:terminal, :on_enter, :add_history, :buffer, :(Base.isempty),
204+
for f in [:terminal, :on_enter, :add_history, :_buffer, :(Base.isempty),
205205
:replace_line, :refresh_multi_line, :input_string, :update_display_buffer,
206206
:empty_undo, :push_undo, :pop_undo, :options, :cancel_beep, :beep,
207207
:deactivate_region, :activate_region, :is_region_active, :region_active]
@@ -2355,10 +2355,11 @@ function run_interface(terminal::TextTerminal, m::ModalInterface, s::MIState=ini
23552355
end
23562356
end
23572357

2358-
buffer(s::PromptState) = s.input_buffer
2359-
buffer(s::SearchState) = s.query_buffer
2360-
buffer(s::PrefixSearchState) = s.response_buffer
2361-
buffer(s::IOBuffer) = s
2358+
buffer(s) = _buffer(s)::IOBuffer
2359+
_buffer(s::PromptState) = s.input_buffer
2360+
_buffer(s::SearchState) = s.query_buffer
2361+
_buffer(s::PrefixSearchState) = s.response_buffer
2362+
_buffer(s::IOBuffer) = s
23622363

23632364
position(s::Union{MIState,ModeState}) = position(buffer(s))
23642365

stdlib/REPL/src/Terminals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ if Sys.iswindows()
130130
t.in_stream, t.out_stream, t.err_stream)
131131
true
132132
else
133-
ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), t.in_stream.handle, raw) != -1
133+
ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), t.in_stream.handle::Ptr{Cvoid}, raw) != -1
134134
end
135135
end
136136
else
137137
function raw!(t::TTYTerminal, raw::Bool)
138138
check_open(t.in_stream)
139-
ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), t.in_stream.handle, raw) != -1
139+
ccall(:jl_tty_set_mode, Int32, (Ptr{Cvoid},Int32), t.in_stream.handle::Ptr{Cvoid}, raw) != -1
140140
end
141141
end
142142

0 commit comments

Comments
 (0)