Commit graph

51 commits

Author SHA1 Message Date
SilverPhoenix99
5b9f3ed326 [ruby/reline] Fixed Ctrl+Enter key in Windows.
0c38e39023
2021-07-30 02:27:02 +09:00
SilverPhoenix99
1bf768d2e1 [ruby/reline] Added support for Numpad divide key on Windows.
84577da0c4
2021-07-30 02:27:02 +09:00
aycabta
750359ce81 [ruby/reline] Support Enter key of numpad on Windows
The yamatanooroti gem can't emulate numpad key pressing...

8e9da1aeaf
2021-07-30 02:27:02 +09:00
Lars Kanis
03f8c27179 [ruby/reline] Windows cmd: Don't type anything when pressing ALT keys alone
Fixes #298

72acfcd27a
2021-07-30 02:27:02 +09:00
aycabta
8135f489be [ruby/reline] Add binding C-x C-x to em_exchange_mark on Windows
24a2489b62
2021-06-21 17:58:49 +09:00
aycabta
fa5a258e93 [ruby/reline] Treat C-Space as M-Space on Windows
69beca2863
2021-06-21 17:58:49 +09:00
aycabta
26f31f880c [ruby/reline] Treat return key correctly on Windows
To fix Reline::TestRendering#test_binding_for_vi_movement_mode.

0df3d2a1dc
2021-06-21 17:58:48 +09:00
aycabta
c59bbd86a6 [ruby/reline] Use ReadConsoleInputW() instead of getwch()
This needs https://github.com/aycabta/yamatanooroti/pull/19, which is released
by yamatanooroti gem 0.0.7, to test with yamatanooroti.

06c1f45da1
2021-06-21 17:58:48 +09:00
aycabta
5543695a19
[ruby/reline] Separate keystrokes each editing mode
ee23e6f3f8
2021-04-08 21:41:00 +09:00
cremno
a7dda449e8 [ruby/reline] fix Reline::Windows.getconsolemode buffer
use double quotes to properly convert the \000 escape sequence.

236dfe5683
2021-02-22 12:19:21 +09:00
Yoshinao Muramatu
38d30a6942 [ruby/reline] check ENABLE_VIRTUAL_TERMINAL_PROCESSING flag and switch eof processing
3535676689
2021-02-21 06:43:52 +09:00
aycabta
e1449ae74f [ruby/reline] Reline::Windows.erase_after_cursor erases attributes too
68b961dfc7
2021-01-18 02:09:53 +09:00
aycabta
cdf2790aa0 [ruby/reline] Support longer than screen height on Windows
2a97ca9362
2020-12-17 20:17:22 +09:00
aycabta
55cc397a87 [ruby/reline] Suppress callbacks in pasting
IRB uses Reline's 3 dynamic real-time callbacks with calling Ripper;
output_modifier_proc, prompt_proc, and auto_indent_proc. These processing
times make the paste time too long.

beec3399a8
2020-12-05 02:58:58 +09:00
aycabta
ae508633b7 Suppress "assigned but unused variable" warning 2020-09-12 10:07:18 +09:00
Yoshinao Muramatu
a840ef8569 [ruby/reline] not clear scrollback buffer
ba800f1461
2020-09-12 08:35:51 +09:00
Yoshinao Muramatu
0862744010 [ruby/reline] clear_screen use Windows API
2c5ee54cb3
2020-09-12 08:35:51 +09:00
aycabta
2efb38e766 [ruby/reline] Use IO#write instead of IO#print
IO#print always adds a string of $\ automatically.

a93119c847
2020-02-14 22:47:27 +09:00
aycabta
06c37fa5b4 [ruby/reline] Bypass cursor down when a char is rendered at eol on Windows
A newline is automatically inserted if a character is rendered at eol on
Windows command prompt.

4bfea07e4a
2020-02-02 03:28:20 +09:00
aycabta
16d4774da1 [ruby/reline] Fix Reline::Windows#scroll_down
I mistook Right and Bottom.

8be401c5f5
2020-02-02 03:28:07 +09:00
Lars Kanis
d1166c6d39 Reline: Use a more robust detection of MinTTY
The previous detection per get_screen_size fails when stdout is passed
to a pipe. That is the case when running ruby tests in parallel ("-j" switch).
In this case Reline believes that it's running on MinTTY and the tests
are running with ANSI IOGate instead of the Windows adapter on MINGW.
So parallel test results were different to that of a single process.
This commit fixes these differencies.

The code is taken from git sources and translated to ruby.
NtQueryObject() is replaced by GetFileInformationByHandleEx(), because
NtQueryObject() is undocumented and is more difficult to use:
  c5a03b1e29/compat/winansi.c (L558)
2020-01-21 21:26:58 +09:00
aycabta
f8ea2860b0 Introduce an abstracted structure about the encoding of Reline
The command prompt on Windows always uses Unicode to take input and print
output but most Reline implementation depends on Encoding.default_external.
This commit introduces an abstracted structure about the encoding of Reline.
2020-01-14 15:40:38 +09:00
aycabta
7bcc639c72 Rename old var name with new name 2019-10-25 10:07:17 +09:00
aycabta
6df6611ce7 Treat only left alt key as meta-key on Windows
On German keyboard, right alt key acts as like shift key.

Ex. right-alt-8 is just "[". This input doesn't have meta-key statement.
2019-10-24 02:49:14 +09:00
aycabta
7bc787fa06 Support forced enter insertion by Ctrl+Enter on Windows 2019-10-24 00:12:58 +09:00
aycabta
8bb716ab91 Fix indent... 2019-10-23 19:57:31 +09:00
aycabta
8c0629ba58 Treat key sequences from getwch() that start from 0 or 0xE0 correctly 2019-10-18 02:54:20 +09:00
aycabta
58657fa134 Add numeric keypad key sequences on Windows 2019-10-18 02:54:20 +09:00
aycabta
53c05a6cf4 Remove freeze 2019-10-18 02:54:20 +09:00
aycabta
13b106a19c 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.
2019-10-18 02:54:20 +09:00
aycabta
136116819e Use built-in Win32API on JRuby
It's fixed for JRuby dedicatedly.
2019-10-07 14:15:05 +09:00
aycabta
85dc89c907 Treat Japanese IME on/off code correctly 2019-09-02 06:37:25 +09:00
aycabta
a39b26b594 Check events that console window size changed on Windows 2019-08-29 21:11:53 +09:00
aycabta
3a425c7623 Fix alignment of a SHORT variable
typedef struct _COORD {
  SHORT X;
  SHORT Y; // I wanted to take this...
} COORD, *PCOORD;

typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
  COORD      dwSize;
  COORD      dwCursorPosition; // ...of this one
  WORD       wAttributes;      // But it's combined with first 2bytes of this
  SMALL_RECT srWindow;
  COORD      dwMaximumWindowSize;
} CONSOLE_SCREEN_BUFFER_INFO;

If wAttributes has non-zero value, the code breaks.
2019-08-29 21:05:19 +09:00
aycabta
b74dd665c0 CONSOLE_SCREEN_BUFFER_INFO is 22bytes
typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
  COORD      dwSize;              // 4(SHORT X, Y)
  COORD      dwCursorPosition;    // 4
  WORD       wAttributes;         // 2
  SMALL_RECT srWindow;            // 8(SHORT Left, Top, Right, Bottom)
  COORD      dwMaximumWindowSize; // 4
} CONSOLE_SCREEN_BUFFER_INFO;
2019-08-29 21:03:44 +09:00
aycabta
893900dc78 Add stub set_screen_size for other platforms 2019-08-29 15:21:00 +09:00
aycabta
7df65ef676 Use inputrc data for keystroke setting 2019-06-01 09:06:27 +09:00
Nobuyoshi Nakada
552c42f51f
Seprate raw keystroke config for each platforms 2019-06-01 00:41:17 +09:00
aycabta
fafcbe0eb0 Use reversed get_screen_size correctly on Windows 2019-05-29 18:52:34 +09:00
aycabta
ccfb12d76c Fix condition..."and" is lowest priority operator, than "=" 2019-05-28 11:03:02 +09:00
aycabta
74c88e7cda Fix reversed row and column get_screen_size on Windows 2019-05-28 05:10:49 +09:00
aycabta
f6b62d8fe7 Use Shift+Enter as Meta+Enter on Windows 2019-05-28 04:39:29 +09:00
aycabta
8b135cc875 Use VK_MENU instead of VK_LMENU to check ALT on Windows 2019-05-28 04:25:50 +09:00
aycabta
eb4e774711 Support Meta key in Reline 2019-05-24 23:38:40 +09:00
aycabta
0f45bd0584 Split namespace of env-dependent I/O classes 2019-05-13 00:22:27 +09:00
aycabta
3be5907e73 Move Win32API to Reline::Win32API 2019-04-30 12:53:20 +09:00
aycabta
17350c7e55 Add Reline as a fallback library for Readline
* lib/reine.rb, lib/reline/*: Reline is a readline stdlib compatible
  library.
* lib/readline.rb: Readline uses a fallback to Reline when ext/readline
  doesn't exist.
* tool/sync_default_gems.rb: add ruby/reline as a default gem.
* appveyor.yml: add "set RELINE_TEST_ENCODING=Windows-31J" for test suit
  of Reline, and add "--exclude readline" to "nmake test-all" on Visual
  Studio builds because of strange behavior.
* spec/ruby/library/readline/spec_helper.rb: skip Reline as with
  RbReadline.
2019-04-30 11:44:20 +09:00
Nobuyoshi Nakada
f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta
f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta
51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00