lib/byebug/processor.rb in byebug-1.3.0 vs lib/byebug/processor.rb in byebug-1.3.1

- old
+ new

@@ -23,30 +23,24 @@ end class CommandProcessor < Processor attr_reader :display - # FIXME: get from Command regexp method. - @@Show_breakpoints_postcmd = [ - /^\s*b(?:reak)?/, - /^\s* cond(?:ition)? (?:\s+(\d+)\s*(.*))?$/ix, - /^\s*del(?:ete)?(?:\s+(.*))?$/ix, - /^\s* dis(?:able)? (?:\s+(.*))?$/ix, - /^\s* en(?:able)? (?:\s+(.*))?$/ix - # "tbreak", "clear", + @@Show_breakpoints_postcmd = [ Byebug::BreakCommand.new(nil).regexp, + Byebug::ConditionCommand.new(nil).regexp, + Byebug::DeleteCommand.new(nil).regexp, + Byebug::DisableCommand.new(nil).regexp, + Byebug::EnableCommand.new(nil).regexp ] - @@Show_annotations_run = [ - /^\s*c(?:ont(?:inue)?)?(?:\s+(.*))?$/, - /^\s*fin(?:ish)?$/, - /^\s*n(?:ext)?([+-])?(?:\s+(.*))?$/, - /^\s*s(?:tep)?([+-])?(?:\s+(.*))?$/ - ] - - @@Show_annotations_postcmd = [ - /^\s* down (?:\s+(.*))? .*$/x, - /^\s* f(?:rame)? (?:\s+ (.*))? \s*$/x, - /^\s* u(?:p)? (?:\s+(.*))?$/x + @@Show_annotations_run = [ Byebug::ContinueCommand.new(nil).regexp, + Byebug::FinishCommand.new(nil).regexp, + Byebug::NextCommand.new(nil).regexp, + Byebug::StepCommand.new(nil).regexp + ] + @@Show_annotations_postcmd = [ Byebug::DownCommand.new(nil).regexp, + Byebug::FrameCommand.new(nil).regexp, + Byebug::UpCommand.new(nil).regexp ] def initialize(interface = LocalInterface.new) @interface = interface @display = [] @@ -84,12 +78,16 @@ Pathname.new(filename).cleanpath.to_s end end def self.print_location_and_text(file, line) - file_line = "#{canonic_file(file)} @ #{line}\n" \ - "#{Byebug.line_at(file, line)}\n" + if file == '(irb)' + file_line = "#{canonic_file(file)} @ #{line}\n" + else + file_line = "#{canonic_file(file)} @ #{line}\n" \ + "#{Byebug.line_at(file, line)}\n" + end # FIXME: use annotations routines if Byebug.annotate.to_i > 2 file_line = "\032\032source #{file_line}" end @@ -121,11 +119,11 @@ file = CommandProcessor.canonic_file(breakpoint.source) line = breakpoint.pos if Byebug.annotate.to_i > 2 print afmt("source #{file}:#{line}") end - print "Stopped by breakpoint %d at %s:%s\n", n, file, line + print "Stopped by breakpoint #{n} at #{file}:#{line}\n" end protect :at_breakpoint def at_catchpoint(context, excpt) aprint 'stopped' if Byebug.annotate.to_i > 2 @@ -144,16 +142,16 @@ def at_tracing(context, file, line) # Don't trace ourselves return if defined?(Byebug::BYEBUG_SCRIPT) && Byebug::BYEBUG_SCRIPT == file - file = CommandProcessor.canonic_file(file) tracing_plus = Command.settings[:tracing_plus] if file != @last_file || line != @last_line || tracing_plus == false @last_file = file @last_line = line - print "Tracing: #{file}:#{line} #{Byebug.line_at(file, line)}\n" + print "Tracing: #{CommandProcessor.canonic_file(file)}:#{line} " \ + "#{Byebug.line_at(file,line)}\n" end always_run(context, file, line, 2) end protect :at_tracing @@ -230,10 +228,10 @@ end end preloop(commands, context) - if Command.settings[:autolist] == 0 + if Command.settings[:autolist] == 0 || file == '(irb)' CommandProcessor.print_location_and_text(file, line) end while !state.proceed? input = @interface.command_queue.empty? ?