|
75 | 75 |
|
76 | 76 | function breakpoint_linenumbers(frame::Frame)
|
77 | 77 | framecode = frame.framecode
|
78 |
| - breakpoint_lines = Int[] |
| 78 | + breakpoint_lines = Dict{Int, BreakpointState}() |
79 | 79 | for stmtidx in 1:length(framecode.breakpoints)
|
80 | 80 | isassigned(framecode.breakpoints, stmtidx) || continue
|
81 | 81 | bp = framecode.breakpoints[stmtidx]
|
82 |
| - push!(breakpoint_lines, JuliaInterpreter.linenumber(frame, stmtidx)) |
| 82 | + line = JuliaInterpreter.linenumber(frame, stmtidx) |
| 83 | + breakpoint_lines[line] = bp |
83 | 84 | end
|
84 | 85 | return breakpoint_lines
|
85 | 86 | end
|
|
199 | 200 |
|
200 | 201 |
|
201 | 202 | const RESET = Crayon(reset = true)
|
| 203 | +function breakpoint_char(bp::BreakpointState) |
| 204 | + if bp.isactive |
| 205 | + return bp.condition === JuliaInterpreter.truecondition ? '●' : '◐' |
| 206 | + end |
| 207 | + return bp.condition === JuliaInterpreter.falsecondition ? ' ' : '○' |
| 208 | +end |
202 | 209 |
|
203 |
| -function print_sourcecode(io::IO, code::String, line::Integer, defline::Integer, breakpoint_lines::Vector{Int} = []) |
| 210 | +function print_sourcecode(io::IO, code::String, line::Integer, defline::Integer, breakpoint_lines::Dict{Int, BreakpointState} = Dict{Int, BreakpointState}()) |
204 | 211 | code = highlight_code(code; context=io)
|
205 | 212 | file = SourceFile(code)
|
206 | 213 | startoffset, stopoffset = compute_source_offsets(code, file.offsets[line], defline, line+NUM_SOURCE_LINES_UP_DOWN[]; file=file)
|
@@ -238,12 +245,10 @@ function print_sourcecode(io::IO, code::String, line::Integer, defline::Integer,
|
238 | 245 | code[i] = code[i][min_indentation+1:end]
|
239 | 246 | end
|
240 | 247 |
|
241 |
| - filter!(x -> x in(startline:stopline), breakpoint_lines) |
242 |
| - |
243 | 248 | for textline in code
|
244 |
| - break_on_line = lineno in breakpoint_lines |
| 249 | + break_on_line = haskey(breakpoint_lines, lineno) |
245 | 250 | prefix = (" ", :normal)
|
246 |
| - break_on_line && (prefix = ("●", :light_red)) |
| 251 | + break_on_line && (prefix = (breakpoint_char(breakpoint_lines[lineno]), :light_red)) |
247 | 252 | lineno == current_line && (prefix = (">", :yellow))
|
248 | 253 | printstyled(io,
|
249 | 254 | string(prefix[1], lpad(lineno, stoplinelength), " "),
|
|
0 commit comments