Skip to content

Commit

Permalink
[ruby/reline] Treat return key correctly on Windows
Browse files Browse the repository at this point in the history
To fix Reline::TestRendering#test_binding_for_vi_movement_mode.

ruby/reline@0df3d2a1dc
  • Loading branch information
aycabta committed Jun 21, 2021
1 parent 754bfc6 commit 26f31f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/reline/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def call(*args)
end
end

VK_RETURN = 0x0D
VK_MENU = 0x12
VK_LMENU = 0xA4
VK_CONTROL = 0x11
Expand Down Expand Up @@ -207,7 +208,12 @@ def self.process_key_event(repeat_count, virtual_key_code, virtual_scan_code, ch
elsif char_code == 0 and control_key_state != 0
# unknown
else
@@output_buf.concat(char.bytes)
case virtual_key_code
when VK_RETURN
@@output_buf.push("\n".ord)
else
@@output_buf.concat(char.bytes)
end
end
end

Expand Down

0 comments on commit 26f31f8

Please sign in to comment.