Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about adding an option to disable command repeat (on Enter key)? #764

Closed
blocknotes opened this issue Sep 24, 2022 · 3 comments · Fixed by #793
Closed

What about adding an option to disable command repeat (on Enter key)? #764

blocknotes opened this issue Sep 24, 2022 · 3 comments · Fixed by #793

Comments

@blocknotes
Copy link

Your proposal
It's a minor thing but it would be nice to have an option to disable command repeat when the Enter key is pressed in debug console.

Additional context
For users coming from pry it could be confusing to have the repeat feature on Enter.
Also, IMO, it's not comfortable repeating some commands that have side-effects. Ex. SomeModel.create! name: 'A test'

@blocknotes
Copy link
Author

blocknotes commented Sep 24, 2022

I could try a PR if you like.

Perhaps it could be something like updating this point:
https://github.com/ruby/debug/blob/master/lib/debug/session.rb#L407

to:

@repl_prev_line = line unless ENV['RUBY_DEBUG_NO_REPEAT_ON_ENTER'] # TODO: replace the ENV with a new option in config.rb

@ko1
Copy link
Collaborator

ko1 commented Oct 4, 2022

  • It is useful for step/next/... and so on
  • I also understand the Ruby script like SomeModel.create! name: 'A test' is not confortable.

Your request is adding new option to stop the repeating the command, but another option is don't repeat Ruby script.
I'm okay for that.

ko1 added a commit that referenced this issue Nov 3, 2022
SessionCommand class represents the session commands attributes.

* repeat: repeat on empty command.
* cancel_auto_continue: cancel auto continue on `source`.
* postmortem: available on postmortem mode.
* unsafe: unsafe command (not supported).

Now only a few commands such as `step`, `next`, ... are
`repeat`able.

Maybe it fixes #764
@ko1 ko1 closed this as completed in #793 Nov 4, 2022
ko1 added a commit that referenced this issue Nov 4, 2022
SessionCommand class represents the session commands attributes.

* repeat: repeat on empty command.
* cancel_auto_continue: cancel auto continue on `source`.
* postmortem: available on postmortem mode.
* unsafe: unsafe command (not supported).

Now only a few commands such as `step`, `next`, ... are
`repeat`able.

Maybe it fixes #764
@ko1
Copy link
Collaborator

ko1 commented Nov 4, 2022

#793 limited the repeatable commands, like step, next, ... and Ruby expression is no longer repeated with empty line.
If you feel inconvenience with it, please reopen or renew an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants