Backport #5023
closedirb does not like window resizes
Description
- open irb
- type until line wraps to the next line
- increase the width of the terminal
- notice that the text of in the second line will not come up to the first line.
-> there is no more useful display/navigation in long lines unless window is resized to exactly the same width. :(
My irb uses libreadline. (Readline module is visible and config in ~/.inputrc is applied.)
Other readline applications like bash do not have that problem.
irb in 1.8 works fine, too.
all versions of 1.9 (including head) have the described problem.
(I tested mainly on my ubuntu box.)
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to keiju (Keiju Ishitsuka)
- Target version set to 2.0.0
Updated by ralf.kistner@gmail.com (Ralf Kistner) over 12 years ago
This is solved by using Readline.set_screen_size(lines, columns) to the correct size, every time the size has changed.
The only reliable way I've found to get the terminal size (on Ubuntu) is with the 'ruby-terminfo' gem: https://github.com/genki/ruby-terminfo
require 'terminfo'
Readline.set_screen_size(TermInfo.screen_size[0], TermInfo.screen_size[1])
Calling the above two lines before each readline() solved the issue for me.
Instead of polling for the terminal size, we could instead trap the SIGWINCH signal:
require 'terminfo'
Signal.trap('SIGWINCH', proc { Readline.set_screen_size(TermInfo.screen_size[0], TermInfo.screen_size[1]) })
Also see my answer on this stackoverflow post: http://stackoverflow.com/a/10444128/214837
Updated by zzak (zzak _) almost 12 years ago
Using 1.9.3-p372 I was able to reproduce this issue, but unable to reproduce in 2.0.0-dev.
Updated by zzak (zzak _) almost 12 years ago
I think we just need to backport to 1.9.3 branch, but I'm not sure what to backport.
Updated by keiju (Keiju Ishitsuka) almost 12 years ago
zzak (Zachary Scott) wrote:
I think we just need to backport to 1.9.3 branch, but I'm not sure what to backport.
I have identified a commit which solve this problem.
The commit is revision 36130.
I think the following is applied only:
--- ext/readline/readline.c (revision 38896)
+++ ext/readline/readline.c (working copy)
@@ -1679,9 +1679,7 @@
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
#endif
-#ifdef HAVE_RL_CATCH_SIGWINCH
- rl_catch_sigwinch = 0;
-#endif
#ifdef HAVE_RL_CLEAR_SIGNALS
rl_clear_signals();
#endif
Updated by zzak (zzak _) almost 12 years ago
Thank you Keiju-san!
Will you please open a backport request for usa?
Updated by keiju (Keiju Ishitsuka) almost 12 years ago
- Assignee changed from keiju (Keiju Ishitsuka) to usa (Usaku NAKAMURA)
- Target version changed from 2.0.0 to 1.9.3
zzak (Zachary Scott) wrote:
Thank you Keiju-san!
Will you please open a backport request for usa?
OK.
Usa-san, yoroshiku.
Updated by usa (Usaku NAKAMURA) almost 12 years ago
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport193
- Target version deleted (
1.9.3)
Updated by usa (Usaku NAKAMURA) over 11 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39377.
Michael, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 36130: [Backport #5023]
* ext/readline/readline.c (Init_readline): don't set 0 to
rl_catch_signals and rl_catch_sigwinch. [Bug #5423]