From e468d9f49ca34f713c030c623f655a40370e186d Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 29 Aug 2020 20:48:25 +0900 Subject: [ruby/irb] Add OMIT_ON_ASSIGNMENT Omit the results evaluated at assignment if they are too long. The behavior of ECHO_ON_ASSIGNMENT being on by default is hard to understand, so I change it to off by default. Instead, we turn OMIT_ON_ASSIGNMENT on by default. The result is displayed on assignment, but it will always be short and within one line of the screen. https://github.com/ruby/irb/commit/c5ea79d5ce --- lib/irb/input-method.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/irb/input-method.rb') diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 7cb211354b..6e87488753 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -12,6 +12,7 @@ require_relative 'src_encoding' require_relative 'magic-file' require_relative 'completion' +require 'io/console' require 'reline' module IRB @@ -36,6 +37,14 @@ module IRB end public :gets + def winsize + if instance_variable_defined?(:@stdout) + @stdout.winsize + else + [24, 80] + end + end + # Whether this input method is still readable when there is no more data to # read. # -- cgit v1.2.3