ruby / irb

interactive Ruby
BSD 2-Clause "Simplified" License
390 stars 119 forks source link

Prompt always delayed with --noreadline --nomultiline #127

Closed dgutov closed 3 years ago

dgutov commented 4 years ago

Description

What are your expected behavior and actual behavior of your environment?

Launch irb --nomultiline --noreadline.

After sending some input, I can only see the prompt if I press RET again. Here's how the session looks:

$ irb --noreadline --nomultiline
irb(main):001:0> 3
=> 3
4
irb(main):002:0> => 4
5
irb(main):003:0> => 5
6
irb(main):004:0> => 6

irb(main):005:0> irb(main):006:0> 7
=> 7
8
irb(main):007:0> => 8
8 + 9
irb(main):008:0> => 17

irb(main):009:0> irb(main):010:0> 

See another example in the original report: https://github.com/nonsequitur/inf-ruby/issues/137

Terminal Emulator

What's your terminal emulator?

gnome-terminator, gnome-terminal and Emacs' comint all exhibit the problem.

Setting Files

Are you using ~/.irbrc and ~/.inputrc?

No.

nobu commented 4 years ago

What is your IRB::VERSION?

dgutov commented 4 years ago

1.2.3

dgutov commented 4 years ago

1.2.4 also behaves the same.

stoyanovskiy239 commented 3 years ago

The problem persists in 1.2.6 and 1.2.7. Seems to be a regression given that StdioInputMethod works fine on Ruby 2.6.5 and irb 1.0.0 (bash, macOS Catalina)

UNIT-1622:~ sergey.stoyanovsky$ rvm use 2.6
Using /Users/sergey.stoyanovsky/.rvm/gems/ruby-2.6.5
UNIT-1622:~ sergey.stoyanovsky$ irb -v
irb 1.0.0 (2018-12-18)
UNIT-1622:~ sergey.stoyanovsky$ irb --noreadline
2.6.5 :001 > 1
 => 1 
2.6.5 :002 > 2
 => 2 
2.6.5 :003 > 3
 => 3 
2.6.5 :004 > irb_context.io.inspect
 => "#<IRB::StdioInputMethod:0x00007ff5fe101778 @file_name=\"(line)\", @line_no=4, @line=[nil, \"1\\n\", \"2\\n\", \"3\\n\", \"irb_context.io.inspect\\n\"], @stdin=#<IO:fd 0>, @stdout=#<IO:fd 1>, @prompt=\"2.6.5 :004 > \">" 
aycabta commented 3 years ago

@dgutov @stoyanovskiy239 I think this is fixed by https://github.com/ruby/irb/pull/152. Would you check the latest irb and reline gem by gem install irb reline?

dgutov commented 3 years ago

Looks fixed indeed, with irb 1.3.0 and reline 0.2.0.

Thanks!