Skip to content

Commit b4dbfe2

Browse files
committed
Refactor
1 parent cd158f3 commit b4dbfe2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/debug/thread_client.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,19 +489,19 @@ def get_src(frame:,
489489
end
490490

491491
def show_src(frame_index: @current_frame_index, update_line: false, max_lines: CONFIG[:show_src_lines] || 10, **options)
492-
return unless @target_frames
493-
frame = @target_frames[frame_index]
494-
start_line, end_line, lines = get_src(frame: frame, max_lines: max_lines, **options)
492+
if frame = get_frame(frame_index)
493+
start_line, end_line, lines = get_src(frame: frame, max_lines: max_lines, **options)
495494

496-
if start_line
497-
if update_line
498-
frame.show_line = end_line
499-
end
495+
if start_line
496+
if update_line
497+
frame.show_line = end_line
498+
end
500499

501-
puts "[#{start_line+1}, #{end_line}] in #{frame.pretty_path}" if !update_line && max_lines != 1
502-
puts lines[start_line...end_line]
503-
else
504-
puts "# No sourcefile available for #{frame.path}"
500+
puts "[#{start_line+1}, #{end_line}] in #{frame.pretty_path}" if !update_line && max_lines != 1
501+
puts lines[start_line...end_line]
502+
else
503+
puts "# No sourcefile available for #{frame.path}"
504+
end
505505
end
506506
end
507507

0 commit comments

Comments
 (0)