diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-09-01 14:14:46 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-09-01 16:36:16 +0900 |
commit | 59e8569cf938e0e449fd649b564da995ffb67470 (patch) | |
tree | 28ca70ed7be2b63cb6f49e9698c71cc4bffada18 /lib | |
parent | f229b36087f1b387d77af8f3fa50f9bffd2fd44e (diff) |
[ruby/reline] Support dumb terminal
The "dumb" terminal is considered only on MSys tty now. However, the
`TERM` feature has been used on many Unix-like systems for decades,
not MSys specific.
https://github.com/ruby/reline/commit/53fd51ab62
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 0487232a0d..f22b573e6d 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -601,24 +601,21 @@ module Reline end require 'reline/general_io' -if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ - require 'reline/windows' - if Reline::Windows.msys_tty? - Reline::IOGate = if ENV['TERM'] == 'dumb' - Reline::GeneralIO - else - require 'reline/ansi' - Reline::ANSI - end +io = Reline::GeneralIO +unless ENV['TERM'] == 'dumb' + case RbConfig::CONFIG['host_os'] + when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ + require 'reline/windows' + tty = (io = Reline::Windows).msys_tty? else - Reline::IOGate = Reline::Windows + tty = $stdout.tty? end +end +Reline::IOGate = if tty + require 'reline/ansi' + Reline::ANSI else - Reline::IOGate = if $stdout.isatty - require 'reline/ansi' - Reline::ANSI - else - Reline::GeneralIO - end + io end + Reline::HISTORY = Reline::History.new(Reline.core.config) |