[前][次][番号順一覧][スレッド一覧]

ruby-changes:66996

From: Lars <ko1@a...>
Date: Fri, 30 Jul 2021 02:27:09 +0900 (JST)
Subject: [ruby-changes:66996] 03f8c27179 (master): [ruby/reline] Windows cmd: Don't type anything when pressing ALT keys alone

https://git.ruby-lang.org/ruby.git/commit/?id=03f8c27179

From 03f8c271796ffb976487495f1675ec7583b6762d Mon Sep 17 00:00:00 2001
From: Lars Kanis <lars@g...>
Date: Thu, 8 Jul 2021 10:09:38 +0200
Subject: [ruby/reline] Windows cmd: Don't type anything when pressing ALT keys
 alone

Fixes #298

https://github.com/ruby/reline/commit/72acfcd27a
---
 lib/reline/windows.rb                       |  3 ---
 test/reline/yamatanooroti/test_rendering.rb | 13 +++++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index 072fb1b..4a36bf4 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -190,9 +190,6 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L190
       # It's treated as Meta+Space on Windows.
       @@output_buf.push("\e".ord)
       @@output_buf.push(char_code)
-    elsif control_key_state.anybits?(LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)
-      @@output_buf.push("\e".ord)
-      @@output_buf.concat(char.bytes)
     elsif control_key_state.anybits?(ENHANCED_KEY)
       case virtual_key_code # Emulate getwch() key sequences.
       when VK_END
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 612fcc5..d2e73ca 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -775,6 +775,19 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L775
       EOC
     end
 
+    def test_brackets
+      omit unless Reline::IOGate.win?
+      start_terminal(20, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
+      write("\x80\M-[\x80\M-{\x80\M-}\x80\M-]\n")
+      close
+      assert_screen(<<~EOC)
+        Multiline REPL.
+        prompt> [{}]
+        => [{}]
+        prompt>
+      EOC
+    end
+
     def test_with_newline
       omit if Reline::IOGate.win?
       cmd = %Q{ruby -e 'print(%Q{abc def \\e\\r})' | ruby -I#{@pwd}/lib -rreline -e 'p Reline.readline(%{> })'}
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]