Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the `ignore_empty_commands` boolean setting. It defaults to false, which causes an empty command to repeat the last command (the current behavior). If true, an empty command is a no-op. I want this setting because I frequently press enter a few times in my Rails server terminal (to put a vertical space in the log entries printed to stdout) and then later I try to debug some code in the server. When the debugger line is executed, ByeBug reads those newlines and runs the last command (often continue). Fixes deivid-rodriguez#700 # Demo ## When the setting is false ``` $ cat ~/.byebugrc set histfile /home/gabrielx/byebug.history #set ignore_empty_commands true $ $ bundle exec ./test.rb [3, 12] in /home/gabrielx/projects/byebug/test.rb 3: 4: require 'byebug' 5: 6: debugger 7: => 8: sleep 2.1 9: debugger 10: 11: sleep 2.2 12: debugger (byebug) c [3, 12] in /home/gabrielx/projects/byebug/test.rb 3: 4: require 'byebug' 5: 6: debugger 7: 8: sleep 2.1 9: debugger 10: => 11: sleep 2.2 12: debugger (byebug) [21, 30] in /home/gabrielx/.rvm/gems/ruby-2.5.3/gems/bundler-2.2.0.rc.2/lib/bundler/cli.rb 21: }.freeze 22: 23: def self.start(*) 24: super 25: ensure => 26: Bundler::SharedHelpers.print_major_deprecations! 27: end 28: 29: def self.dispatch(*) 30: super do |i| (byebug) $ ``` ### When the setting is true ``` $ cat ~/.byebugrc set histfile /home/gabrielx/byebug.history set ignore_empty_commands true $ $ bundle exec ./test.rb [3, 12] in /home/gabrielx/projects/byebug/test.rb 3: 4: require 'byebug' 5: 6: debugger 7: => 8: sleep 2.1 9: debugger 10: 11: sleep 2.2 12: debugger (byebug) c [3, 12] in /home/gabrielx/projects/byebug/test.rb 3: 4: require 'byebug' 5: 6: debugger 7: 8: sleep 2.1 9: debugger 10: => 11: sleep 2.2 12: debugger (byebug) (byebug) (byebug) c [21, 30] in /home/gabrielx/.rvm/gems/ruby-2.5.3/gems/bundler-2.2.0.rc.2/lib/bundler/cli.rb 21: }.freeze 22: 23: def self.start(*) 24: super 25: ensure => 26: Bundler::SharedHelpers.print_major_deprecations! 27: end 28: 29: def self.dispatch(*) 30: super do |i| (byebug) (byebug) (byebug) c $ ```
- Loading branch information