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

<enter> does not repeat last command in irb_console mode. #1063

Closed
joe-sharp opened this issue Jan 17, 2024 · 0 comments · Fixed by ruby/irb#856
Closed

<enter> does not repeat last command in irb_console mode. #1063

joe-sharp opened this issue Jan 17, 2024 · 0 comments · Fixed by ruby/irb#856

Comments

@joe-sharp
Copy link

joe-sharp commented Jan 17, 2024

Your environment

  • ruby -v: 3.2.2 (and 3.0.6p216)
  • rdbg -v: 1.9.1
  • irb -v: 1.11.1

Describe the bug
I saw a similar issue posted before in #617, and maybe this is the cause?
Pressing with a blank prompt does not repeat the last command, but it seems like the issue is isolated to irb:rdbg console.

To Reproduce
This can be reproduced at any time in a irb:rdbg console, regardless of whether you are using binding.irb and manually invoking debug, running rdbg and manually invoking irb, or finally automatically starting in irb:rdbg using RUBY_DEBUG_IRB_CONSOLE=true

Here is the easiest way to reproduce, without needing to edit any files:
Start in rdbg, type 'n' followed by and see it proceed to the next line. Hit at the blank prompt and it proceeds to the next line again.
Type 'pry' followed by , then type 'n' followed by and it proceeds to the next line one more time. Again just hit at the empty prompt and the prompt returns rather than proceeding to the next line like it should.

Console Session:

$ rdbg -c irb
[4, 13] in ~/.asdf/installs/ruby/3.0.6/bin/irb
     4| #
     5| # The application 'irb' is installed as part of a gem, and
     6| # this file is here to facilitate running it.
     7| #
     8|
=>   9| require 'rubygems'
    10|
    11| Gem.use_gemdeps
    12|
    13| version = ">= 0.a"
=>#0	<main> at ~/.asdf/installs/ruby/3.0.6/bin/irb:9
(rdbg) n    # next command
[6, 15] in ~/.asdf/installs/ruby/3.0.6/bin/irb
     6| # this file is here to facilitate running it.
     7| #
     8|
     9| require 'rubygems'
    10|
=>  11| Gem.use_gemdeps
    12|
    13| version = ">= 0.a"
    14|
    15| str = ARGV.first
=>#0	<main> at ~/.asdf/installs/ruby/3.0.6/bin/irb:11
(rdbg)
[8, 17] in ~/.asdf/installs/ruby/3.0.6/bin/irb
     8|
     9| require 'rubygems'
    10|
    11| Gem.use_gemdeps
    12|
=>  13| version = ">= 0.a"
    14|
    15| str = ARGV.first
    16| if str
    17|   str = str.b[/\A_(.*)_\z/, 1]
=>#0	<main> at ~/.asdf/installs/ruby/3.0.6/bin/irb:13
(rdbg) irb    # command
irb:rdbg(main):002> n
[10, 19] in ~/.asdf/installs/ruby/3.0.6/bin/irb
    10|
    11| Gem.use_gemdeps
    12|
    13| version = ">= 0.a"
    14|
=>  15| str = ARGV.first
    16| if str
    17|   str = str.b[/\A_(.*)_\z/, 1]
    18|   if str and Gem::Version.correct?(str)
    19|     version = str
=>#0	<main> at ~/.asdf/installs/ruby/3.0.6/bin/irb:15
irb:rdbg(main):003>
irb:rdbg(main):004>
irb:rdbg(main):005> whereami

From: /Users/joesharp/.asdf/installs/ruby/3.0.6/bin/irb @ line 15 :

    10:
    11: Gem.use_gemdeps
    12:
    13: version = ">= 0.a"
    14:
 => 15: str = ARGV.first
    16: if str
    17:   str = str.b[/\A_(.*)_\z/, 1]
    18:   if str and Gem::Version.correct?(str)
    19:     version = str
    20:     ARGV.shift

=> nil

Expected behavior
I expect the command to be repeated just like in the rdbg console.

Additional context
I tried to investigate to see if IRB support this, and they don't appear to. I wouldn't really expect it to work on anything but the debugger commands of course. If you use binding.irb and run any debug commands you go into the irb:rdbg prompt and the same issue happens.

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