Commit graph

71 commits

Author SHA1 Message Date
aycabta
15fab6fb17 [ruby/reline] Support S-Tab to move up completion cursor in vi-mode on Unix
ff278cdc88
2021-12-24 18:23:28 +09:00
aycabta
95c61c8d82 [ruby/reline] Remove unnecessary clearing signal handler
7a758e73dc
2021-12-21 00:13:18 +09:00
Samuel Williams
b5c4570af4 [ruby/reline] Prefer wait_readable for fiber scheduler.
06b4aa31fd
2021-12-11 14:29:20 +09:00
ima1zumi
4d4716d939 [ruby/reline] No need to check x > 0
Checked in the previous line.

bf774c0f2c
2021-12-03 00:39:30 +09:00
ima1zumi
ca33b59099 [ruby/reline] fix TerminfoError -> Reline::Terminfo::TerminfoError
c07b0ace6a
2021-12-02 23:41:44 +09:00
ima1zumi
697d7b8d62 [ruby/reline] Rescue if tigetstr(capname) cannot be obtained
fix https://github.com/ruby/reline/issues/384

If `$TERM` is `vt102`, there are no `kend`, `khome`, `civis`, or `cnorm` in capabilities.
`TerminfoError` is raised in `Reline::Terminfo.tigetstr(capname)`, so it is rescued if it does not exist.

c9f5112702
2021-12-02 23:41:43 +09:00
TOMITA Masahiro
ef350b3a56 [ruby/reline] Simplify SIGWINCH handler to avoid aborting when resizing.
481add0537
2021-10-03 14:26:53 +09:00
aycabta
935bb4c617 [ruby/reline] Add autocompletion on emacs mode by Tab / S-Tab
22d0b4e5d8
2021-08-30 02:37:23 +09:00
aycabta
02a61fe33f [ruby/reline] Hide cursor when rendering dialog
a9050cf676
2021-08-29 20:30:32 +09:00
aycabta
acce754eb8 [ruby/reline] Remove interrupt avoidance
There used to be a process that did not want to be interrupted by
SIGINT, so it was trapped, but that process is no longer there.

ba7252a5db
2021-08-14 22:13:31 +09:00
Samuel Williams
bf376cae0c [ruby/reline] Fix missing require.
010b28dfe9
2021-06-25 17:42:45 +09:00
Samuel Williams
e788481843 [ruby/reline] Avoid using blocking IO.select.
de94746393
2021-06-25 17:42:45 +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
18b79b4c49 [ruby/reline] Add Meta+arrow-keys in extended entries of terminfo
af6f6ed088
2021-06-21 17:58:48 +09:00
aycabta
5e09da2f7a [ruby/reline] Terminfo.tigetstr and tiparm should return String object
1e287d10cc
2021-06-21 17:58:48 +09:00
aycabta
46c813969b [ruby/reline] Add terminfo support
74a7ffaa2f
2021-06-21 17:58:48 +09:00
aycabta
1b543dc226 [ruby/reline] Handle Errno::ENOTTY correctly
8daa392ba6
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
Robert Schulze
422e2c7274 [ruby/reline] Use plus operator to create unfrozen string
ca274b0d37
2020-12-17 20:20:07 +09:00
Robert Schulze
f4386413f1 Cope with frozen-string-literal
When running irb 1.2.1 (2019-12-24) with frozen-string-literal enabled, it crashes in reline with `can't modify frozen String (FrozenError)`

Steps to reproduce: 

`RUBYOPT="--enable-frozen-string-literal" irb`
2020-12-05 03:14:42 +09:00
aycabta
c2bd5b84d0 [ruby/reline] Support bracketed paste mode
d1a6869322
2020-12-05 02:58:59 +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
777d536749 [ruby/reline] Support for word movement escape sequences in iTerm2
187235f88c
2020-09-12 08:35:52 +09:00
aycabta
2e34b35a0f [ruby/reline] Skip the nil obtained from getc
The nil means there is nothing in the buffer in some systems. Incidentally,
Errno::EIO is raised if the I/O is closed.

c698634e74
2020-09-12 08:35:52 +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
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
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
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
5d124a3b68 [ruby/reline] Support GNOME style Home/End key sequences [Bug #16510]
788f0df845
2020-01-29 15:11:59 +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
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
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
Nobuyoshi Nakada
679bc4f9cb [ruby/reline] Use IO#raw to read one byte
be17740e82
2019-12-23 02:11:22 +09:00
Nobuyoshi Nakada
efd4a11ada Support multibyte input 2019-12-22 11:46:43 +09:00
Yusuke Endoh
fa1bf8ab37 [ruby/reline] Support Ctrl+right as em_next_word, and Ctrl+left as ed_prev_word
e98ad3b486
2019-12-22 05:35:03 +09:00
Yusuke Endoh
ec1de789a9 [ruby/reline] Preserve the input buffer across cursor_pos
The old version of cursor_pos discards the input buffer, which made IRB
ignore the input immediately after IRB is invoked.

This change keeps the input before cursor_pos by using ungetc.

4a8cca331f
2019-12-22 01:57:35 +09:00
Nobuyoshi Nakada
7fd6077d98 [ruby/reline] Consider Reline::ANSI.input at prep
b111cde3c3
2019-12-22 01:57:35 +09:00
Nobuyoshi Nakada
11db4d3a3b [ruby/reline] Disable any implementation-defined special control characters
Including dsusp, lnext, and so on.

a44abe586b
2019-12-17 13:19:37 +09:00
manga_osyo
81586a4d9f Add <Home> <End> keys. 2019-11-21 00:47:36 +09:00
Nobuyoshi Nakada
cef9ebfbd3 Suppress stty error on Apple Terminal
`stty` called in `Reline::ANSI.deprep` command shows the following
error message on macOS Apple Terminal, with some settings.

```
$ LANG=C irb
irb(main):001:0>
stty: 'standard input': unable to perform all requested operations
stty: 'standard input': unable to perform all requested operations
```
2019-11-19 02:39:02 +09:00
aycabta
11ae47c266 [ruby/reline] Restore left cursor key support on Unix like OSes...
98b72af751
2019-11-15 18:07:34 +09:00
aycabta
fa7618e4c1 Implement em_set_mark and em_exchange_mark 2019-11-15 16:50:40 +09:00
aycabta
53c05a6cf4 Remove freeze 2019-10-18 02:54:20 +09:00
Nobuyoshi Nakada
ae83dbe28d Get rid of IO.select to fix multiline paste 2019-09-26 00:26:33 +09:00
aycabta
b443bdbdb9 Use short wait for select(2)
It is one of the reasons why paste to IRB is slow.
2019-09-23 17:33:25 +09:00
aycabta
934507472c Retrieve key-buffer that was supposed to lose 2019-09-23 17:27:01 +09:00