ruby-changes:58860
From: aycabta <ko1@a...>
Date: Wed, 20 Nov 2019 17:57:26 +0900 (JST)
Subject: [ruby-changes:58860] 633625a083 (master): Mintty on Cygwin isn't a kind of command prompt, can process ANSI escape code
https://git.ruby-lang.org/ruby.git/commit/?id=633625a083 From 633625a083c5f02e78355cb12818056e54330e88 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Wed, 20 Nov 2019 17:55:03 +0900 Subject: Mintty on Cygwin isn't a kind of command prompt, can process ANSI escape code diff --git a/lib/reline.rb b/lib/reline.rb index 58a03f8..feee94e 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -16,12 +16,6 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L16 CursorPos = Struct.new(:x, :y) class Core - if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ - IS_WINDOWS = true - else - IS_WINDOWS = false - end - ATTR_READER_NAMES = %i( completion_append_character basic_word_break_characters @@ -400,9 +394,15 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L394 HISTORY = History.new(core.config) end -if Reline::Core::IS_WINDOWS +if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ require 'reline/windows' - Reline::IOGate = Reline::Windows + if Reline::Windows.get_screen_size == [0, 0] + # Maybe Mintty on Cygwin + require 'reline/ansi' + Reline::IOGate = Reline::ANSI + else + Reline::IOGate = Reline::Windows + end else require 'reline/ansi' Reline::IOGate = Reline::ANSI -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/