ruby-changes:58297
From: aycabta <ko1@a...>
Date: Fri, 18 Oct 2019 02:55:25 +0900 (JST)
Subject: [ruby-changes:58297] 13b106a19c (master): Ignore the input method key sequence from getwch() correctly
https://git.ruby-lang.org/ruby.git/commit/?id=13b106a19c From 13b106a19c9c819fb0c887beb4787ab894cdba6c Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 18 Oct 2019 02:15:53 +0900 Subject: Ignore the input method key sequence from getwch() correctly The function getwch() returns some key sequences which start from 0 or 0xE0 with a following key code. Alt+` that is on/off key for input methods gives 0 and 41 so Reline was always ignoring 0 and following keys but numeric keypad keys give 0 and following actual keys. This commit changes the behavior to be ignoring only the 0 and 41 sequence. diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 01e1a5a..18bbbfa 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -9,6 +9,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L9 [224, 83] => :key_delete, # Del [224, 71] => :ed_move_to_beg, # Home [224, 79] => :ed_move_to_end, # End + [ 0, 41] => :ed_unassigned, # input method on/off }.each_key(&:freeze).freeze if defined? JRUBY_VERSION @@ -118,8 +119,8 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L119 else case input when 0x00 - getwch alt = false + @@output_buf.push(input) input = getwch @@output_buf.push(*input) when 0xE0 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/