@@ -211,8 +211,22 @@ function display(d::REPLDisplay, mime::MIME"text/plain", x)
211
211
io = foldl (IOContext, d. repl. options. iocontext,
212
212
init= IOContext (io, :limit => true , :module => Main))
213
213
end
214
+
215
+ infos = Tuple{String,Int}[]
216
+ io = IOContext (io, :LAST_SHOWN_LINE_INFOS => infos)
217
+
214
218
show (io, mime, x)
215
219
println (io)
220
+
221
+ if ! isempty (infos)
222
+ d. repl. last_shown_line_infos = infos
223
+ println (
224
+ io,
225
+ " \n To edit a specific method, type the corresponding number into the " *
226
+ " REPL and press Ctrl+Q" ,
227
+ )
228
+ end
229
+
216
230
nothing
217
231
end
218
232
display (d:: REPLDisplay , x) = display (d, MIME (" text/plain" ), x)
@@ -430,11 +444,12 @@ mutable struct LineEditREPL <: AbstractREPL
430
444
specialdisplay:: Union{Nothing,AbstractDisplay}
431
445
options:: Options
432
446
mistate:: Union{MIState,Nothing}
447
+ last_shown_line_infos:: Vector{Tuple{String,Int}}
433
448
interface:: ModalInterface
434
449
backendref:: REPLBackendRef
435
450
LineEditREPL (t,hascolor,prompt_color,input_color,answer_color,shell_color,help_color,history_file,in_shell,in_help,envcolors) =
436
451
new (t,hascolor,prompt_color,input_color,answer_color,shell_color,help_color,history_file,in_shell,
437
- in_help,envcolors,false ,nothing , Options (), nothing )
452
+ in_help,envcolors,false ,nothing , Options (), nothing , Tuple{String,Int}[] )
438
453
end
439
454
outstream (r:: LineEditREPL ) = r. t
440
455
specialdisplay (r:: LineEditREPL ) = r. specialdisplay
@@ -1092,10 +1107,10 @@ function setup_interface(
1092
1107
end ,
1093
1108
1094
1109
# Open the editor at the location of a stackframe or method
1095
- # This is accessing a global variable that gets set in
1110
+ # This is accessing a contextual variable that gets set in
1096
1111
# the show_backtrace and show_method_table functions.
1097
1112
" ^Q" => (s, o... ) -> begin
1098
- linfos = Base . LAST_SHOWN_LINE_INFOS
1113
+ linfos = repl . last_shown_line_infos
1099
1114
str = String (take! (LineEdit. buffer (s)))
1100
1115
n = tryparse (Int, str)
1101
1116
n === nothing && @goto writeback
0 commit comments