Commit graph

624 commits

Author SHA1 Message Date
aycabta
770e66030a [ruby/reline] Use str.encoding by default for split_by_width
2d32604c9e
2020-09-12 08:35:51 +09:00
Hiroshi SHIBATA
b194973dcd
Revert the related commits about Tempfile.open change.
Start with fa21985a7a
  to d7492a0be8
2020-09-09 21:10:48 +09:00
Benoit Daloze
3beecafc2c Fix usages of Tempfile.open(&block) that expected the file to still be there after the block 2020-08-29 12:30:24 +02:00
aycabta
1f09c43628 [ruby/reline] Move width calculator methods to Reline::Unicode
f348ecd9f5
2020-08-28 11:05:18 +09:00
tompng
cdd7d41046 [ruby/reline] fix cursor_pos regexp match
1dd80ef188
2020-08-28 11:05:18 +09:00
Nobuyoshi Nakada
4f697bcf73
Strip trailing spaces [ci skip] 2020-08-18 20:10:34 +09:00
Nobuyoshi Nakada
f2435c1508 [ruby/reline] Get rid of loading pathname unnecessarily
9bd54b7f1c
2020-08-18 19:09:58 +09:00
Maciej Mensfeld
d1b06229fa [ruby/reline] Use the standard SPDX ID for license in gemspec
It is better to use SPDX ID for license field:

https://guides.rubygems.org/specification-reference/#license=

ref: https://spdx.org/licenses/Ruby.html
8468a727e5
2020-08-18 19:09:43 +09:00
aycabta
ad24eaabfd [ruby/reline] Remove duplicated line of code
Co-authored-by: Quentin Sabah <quentin.sabah@gmail.com>

5526e9f7ee
2020-08-18 19:08:50 +09:00
aycabta
80a7358cfc [ruby/reline] Keep original characters in inputrc
96583c6336
2020-08-18 19:08:40 +09:00
Mark Delk
44b24ab4c1 [ruby/reline] Support mode icon
Co-authored-by: aycabta <aycabta@gmail.com>

067b618123
2020-08-18 19:08:32 +09:00
aycabta
568615d395 [ruby/reline] Use single quotes for non-expanded string literals
3bf7c7d722
2020-08-18 19:08:11 +09:00
aycabta
215fe54777 [ruby/reline] Check Errno::EIO
Catch Errno::EIO what will be occurred if the console terminates I/O before
Reline finishes rendering.

e51eaa6d43
2020-08-18 19:04:31 +09:00
Tomás Pollak
f0d3d4fedb [ruby/reline] Add home/end mapping for urxvt and relatives
c30b293f1c
2020-08-18 19:03:27 +09:00
aycabta
f56e05fa7d [ruby/reline] Remove unnecessary TODO commnet
23c67fb7b3
2020-05-17 19:26:53 +09:00
aycabta
fc2a121c7c [ruby/reline] If history-size isn't numeric, it should be 500
https://tiswww.case.edu/php/chet/readline/readline.html#IDX25

> If an attempt is made to set history-size to a non-numeric value, the maximum
> number of history entries will be set to 500.

acf0437280
2020-05-17 19:26:53 +09:00
aycabta
7a7854d8c1 Some I/O in test doesn't have "position"
Just returns column 1 for ambiguous width because this I/O is not tty and can't
seek.
2020-05-12 02:53:44 +09:00
aycabta
009092b04c [ruby/reline] Add URL reference of history-size
13420197b8
2020-04-29 19:13:14 +09:00
aycabta
213ebec7a7 [ruby/reline] Version 0.1.4
298144b06a
2020-04-29 19:13:14 +09:00
aycabta
4859352df6 [ruby/reline] Negative history_size means unlimited
And unlimited is default.

f5149c3ca6
2020-04-29 19:13:14 +09:00
aycabta
d27fa87418 [ruby/reline] New items to history are dropped if history_size is zero
9bdbed9cbc
2020-04-29 19:13:14 +09:00
Nobuyoshi Nakada
0ac5009165 [ruby/reline] Ignore non-absolute XDG_CONFIG_HOME
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
> All paths set in these environment variables must be absolute.
> If an implementation encounters a relative path in any of these
> variables it should consider the path invalid and ignore it.

45af6eea77
2020-04-29 19:13:14 +09:00
aycabta
9fb20711fd [ruby/reline] Treat home dir correctly
9b1327d2f4
2020-04-24 16:46:36 +09:00
aycabta
81b0b79197 [ruby/reline] Support XDG_CONFIG_HOME
In the XDG Specification, if ~/.config/readline/inputrc exists, then ~/.inputrc
should not be read, but for compatibility with GNU Readline, if ~/.inputrc
exists, then it is given priority.

97f1e7db04
2020-04-24 16:45:07 +09:00
aycabta
db0d850d4e [ruby/reline] Add ed_search_next_history
ca750b676b
2020-04-18 23:12:52 +09:00
aycabta
bea3e31e5f [ruby/reline] Add ed_search_prev_history
e9ae288825
2020-04-18 23:12:52 +09:00
aycabta
08c1c3f220 [ruby/reline] Use vi_search_{prev,next} to incremental search
cab312f584
2020-04-18 23:09:31 +09:00
aycabta
afe997857e [ruby/reline] Rename search_history with incremental_search_history
d563063ea0
2020-04-18 23:09:31 +09:00
aycabta
90913bfabe [ruby/reline] Suppress error in case INPUTRC env is empty
bce7e7562b
2020-03-26 17:41:21 +09:00
aycabta
f245fb1ab8 [ruby/reline] Work with wrong $/ value correctly
962ebf5a1b
2020-03-26 17:41:21 +09:00
aycabta
12ae7b3369 [ruby/reline] Version 0.1.3
ea2b182466
2020-02-15 21:52:03 +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
97b583d68b [ruby/reline] Organize special keys escape sequences
41deb1a3d9
2020-02-09 02:54:41 +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
aycabta
5d124a3b68 [ruby/reline] Support GNOME style Home/End key sequences [Bug #16510]
788f0df845
2020-01-29 15:11:59 +09:00
aycabta
c257d81186 Always use UTF-8 for Reline::GeneralIO on Windows 2020-01-26 12:57:13 +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
2943ebd240 [ruby/reline] Implement vi_change_meta
8538e0e10f
2020-01-21 09:52:32 +09:00
aycabta
3b407abe9b [ruby/reline] Implement vi_prev_char and vi_to_prev_char
0ad3ee63fa
2020-01-20 19:13:19 +09:00
aycabta
b17797a694 [ruby/reline] Implement vi_to_next_char
066ecb0a21
2020-01-20 19:13:19 +09:00
aycabta
800c2a8e4c Implement vi_insert_at_bol and vi_add_at_eol 2020-01-17 01:37:01 +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
7392083c2f Support history-size in .inputrc correctly 2020-01-06 21:50:48 +09:00
aycabta
439e1ccd08 Complete indented and quoted string correctly
def foo
    ''.upca[TAB]

This will be completed to be:

  def foo
  ''.upcase

The indent was gone. This commit fixes the bug.
2020-01-06 01:20:24 +09:00
aycabta
da028a4fbf Rescue EOFError
If C-d is pressed before IRB is ready, IRB crashes because EOFError occurs.
2020-01-05 22:48:39 +09:00
KOBAYASHI Shuji
9b928fa443 [ruby/reline] Sort completion list
#### Legacy mode:

  ```console
  $ irb --legacy
  irb(main):001:0> l[TAB][TAB]
  lambda           load             local_variables  loop
  ```

#### Before this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  local_variables
  loop
  lambda
  load
  ```

#### After this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  lambda
  load
  local_variables
  loop
  ```

6074069c7d
2020-01-05 11:28:01 +09:00
Yusuke Endoh
337ba56aff [ruby/reline] Degenerate the terminal size to [$LINES, $COLUMNS] if it is unknown
This is a workaround for https://github.com/ruby/irb/issues/50

5725677d1a
2019-12-31 23:32:24 +09:00
aycabta
778634f778 Drop an invalid char as UTF-8 2019-12-27 16:02:30 +09:00
aycabta
e1e1d92277 [ruby/reline] Version 0.1.2
b41024e317
2019-12-25 18:47:47 +09:00