class DEBUGGER__::ThreadClient
def get_src(frame,
def get_src(frame, max_lines:, start_line: nil, end_line: nil, dir: +1) if file_lines = frame.file_lines frame_line = frame.location.lineno - 1 if CONFIG[:no_lineno] lines = file_lines else lines = file_lines.map.with_index do |e, i| cur = i == frame_line ? '=>' : ' ' line = colorize_dim('%4d|' % (i+1)) "#{cur}#{line} #{e}" end end unless start_line if frame.show_line if dir > 0 start_line = frame.show_line else end_line = frame.show_line - max_lines start_line = [end_line - max_lines, 0].max end else start_line = [frame_line - max_lines/2, 0].max end end unless end_line end_line = [start_line + max_lines, lines.size].min end if start_line != end_line && max_lines [start_line, end_line, lines] end else # no file lines nil end rescue Exception => e p e pp e.backtrace exit! end