ruby / irb

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

Switch to StdioInputMethod when TERM is 'dumb' #907

Closed dgutov closed 7 months ago

dgutov commented 8 months ago

This works around Reline's misbehavior on low-capability terminals, such as when IRB is launched inside Emacs (which can look like ruby/reline#616, even though that issue is about non-tty usage). It should also resolve #68 and resolve #113 which were filed out of similar need.

The existing solution we use in Emacs with inf-ruby is to detect the current version of the tool and launch it with both --nomultiline and --nosingleline when we think it supports those options. But that only covers one entry point -- having REPL launched from one of the few preset commands in inf-ruby, whereas all the other cases (custom console script by a user; or binding.irb invocation inside a test suite) remain problematic, requiring case-by-case solutions.

The provided simple change looks like a significant improvement in my testing.

dgutov commented 8 months ago

N.B. the older "inverted triangle" issue seems to have been fixed in Reline, somewhere between the versions 0.1.5 and 0.4.3. But the weird input repetition is still a problem.

dgutov commented 8 months ago

The "latest reline" breakage is the same on master.

tompng commented 7 months ago

Looks good! thank you :+1: