Commit graph

7218 commits

Author SHA1 Message Date
aycabta
3b7862c8e8 Use existing instances for LineEditor and Config 2019-05-29 05:53:44 +09:00
aycabta
ccfb12d76c Fix condition..."and" is lowest priority operator, than "=" 2019-05-28 11:03:02 +09:00
aycabta
57b4df07bc Use Reline.completer_quote_characters to complete 2019-05-28 08:38:55 +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
d5682eb939 Remove unused variable from IRB::InputCompletor 2019-05-28 03:25:47 +09:00
aycabta
5e275dd2af Treat :@1, :@@1, @1, and @@1 correctly to check termination 2019-05-28 03:23:52 +09:00
aycabta
7447c7b651 Join next line if deletes newline at end of line 2019-05-28 01:52:04 +09:00
aycabta
69c7ad1723 Exit only when blank input 2019-05-28 01:51:01 +09:00
Kazuki Tsujimoto
b2b5ed1410 Supress duplicated warning 2019-05-28 01:32:07 +09:00
aycabta
9a68aba79f Support OSC and treat \1 \2 correctly 2019-05-28 00:48:02 +09:00
aycabta
70166b3ca3 Revert "Support OSC and treat \1 \2 correctly"
This reverts commit 77bfebebc4.
2019-05-28 00:21:24 +09:00
aycabta
77bfebebc4 Support OSC and treat \1 \2 correctly 2019-05-28 00:17:52 +09:00
Nobuyoshi Nakada
8a2a5822ca
Colorize error part 2019-05-27 23:08:51 +09:00
Nobuyoshi Nakada
4c277364a5
CSI allows empty digit which equals 0 2019-05-27 11:47:09 +09:00
Nobuyoshi Nakada
0aa9b003de
context.rb: hide wrapping lines
* lib/irb/context.rb (IRB::Context#evaluate): separate the code
  from wrapping lines to propagate the given exception, not to show
  the wrapping lines when SyntaxError.
2019-05-27 11:05:51 +09:00
aycabta
9840f52c77 Use IRB::InputMethod#eof? to quit 2019-05-27 10:18:09 +09:00
aycabta
1d301acbe8 Fix rendering bug of ^D 2019-05-27 10:09:21 +09:00
aycabta
9c136f3dea Move to next of last line by ^D 2019-05-27 08:39:39 +09:00
aycabta
4e2c7783e3 Check blank history 2019-05-27 08:13:48 +09:00
aycabta
2805c55aa3 Move to next of last line by ^C 2019-05-27 07:35:35 +09:00
aycabta
c49796c930 Reline should move to next line after finished in Readline mode 2019-05-27 07:00:06 +09:00
Sutou Kouhei
29c16b30ce Add support for history with Reline backend 2019-05-27 06:32:52 +09:00
aycabta
2c91c5b329 Move to the other line when press <- at head or -> at tail 2019-05-27 06:04:42 +09:00
aycabta
716ba4a127 Implement J to join lines in vi command mode 2019-05-27 05:45:08 +09:00
aycabta
64dc21830a Remove \1 and \2 that escape CSI before render 2019-05-27 05:01:18 +09:00
Takashi Kokubun
64ee8900c8
Highlight global variable on IRB 2019-05-26 11:32:23 -07:00
Takashi Kokubun
7597f7ecb1
Simplify lexer state matching in #dispatch_seq
for improving readability of the condition. It may be slightly faster, or may not.
2019-05-26 11:26:04 -07:00
Takashi Kokubun
897901283c
Refactor IRB color dispatch
The reason why we were checking lexer state in addition to token was
that we do not want to colorize local variable, method call, etc., while
they share the :on_ident token with a name of method definition which
should be colored as blue.

It means that we're concerned about the lexer state only for :on_ident.
Thus we can skip checking lexer state for non-:on_ident tokens. This
refactoring is based on that idea.

Also, now we manage Ripper's lexer state as Integer (use `|` if you
need to check multiple states). It should be faster than using Array of
Integer because #any? block call is not needed.
2019-05-26 11:03:57 -07:00
aycabta
e73a68ebc3 Support op, cvar, iver, gvar and kw that follow on symbeg in IRB 2019-05-27 02:59:21 +09:00
aycabta
1226791368 Support :@@cvar and : on colorize 2019-05-27 02:56:05 +09:00
Takashi Kokubun
e50aa359de
Make the imaginary color on IRB close to pry
and sorted the token names alphabetically.
2019-05-26 10:23:04 -07:00
aycabta
60cc03ffe7 Fix indexes in comments of vi_insert.rb
Previous fix was 2993b36133.
2019-05-27 02:13:30 +09:00
aycabta
0f35c79ad6 Fix number literal regexp of IRB completion 2019-05-27 01:59:17 +09:00
aycabta
e39c950c2b Use correctly RI output in IRB completion 2019-05-27 01:24:12 +09:00
Nobuyoshi Nakada
4f2a7b8001
Colorize imaginary and rational literals 2019-05-26 23:46:14 +09:00
Takashi Kokubun
aaf6c678d2
Handle keyword symbol in IRB::Color::SymbolState 2019-05-25 22:32:28 -07:00
Takashi Kokubun
52b09fcee1
Deal with more syntax highlight edge cases
Please refer to the tests again.
2019-05-25 22:29:16 -07:00
Takashi Kokubun
8aba3b7a04
Fix more unintended syntax highlights
See tests for what kind of things are fixed.
2019-05-25 22:07:32 -07:00
Takashi Kokubun
13f58eccda
Always color Symbol as Yellow on IRB::Color
Symbol color was made blue as a workaround because it was hard to
distinguish `foo`s in `:foo` and `def foo; end` (both are :on_ident).
But I wanted to make it yellow like pry.

`:Struct` had the same problem in :on_const. Because the :on_const was
also blue (but underlined and bold), it was not a big issue.

While they're not so problematic since we got a workaround, we also had
a more serious issue for highlighting a symbol like `:"a#{b}c"`.
The first half was considered as Symbol and the last half was considered
as String, because the colorizer did not have a state like a parser.

To approach the last issue, I introduced `IRB::Color::SymbolState` which
is a thin state manager knowing only "the token is Symbol or not". Having
this module magically solves the first two problems as well. So now we
can highlight Symbol as yellow in the perfect manner.
2019-05-25 20:47:33 -07:00
Takashi Kokubun
208ed56e57
Colorize empty embexpr more on IRB::Color 2019-05-25 14:15:08 -07:00
aycabta
ec75901120 Fix completion menu state calculation 2019-05-26 01:32:29 +09:00
Nobuyoshi Nakada
2993b36133
Fix indexes in comments 2019-05-26 00:48:26 +09:00
Takashi Kokubun
98be203704
Support some unhandled syntax highlight
Heredoc, %i, :Foo, { 'a': ... }, ...

:'a' is still half-broken.
2019-05-25 08:19:15 -07:00
aycabta
d9c41f2dec Use Reline.completer_word_break_characters to complete 2019-05-26 00:00:19 +09:00
Takashi Kokubun
ada64aa9e7
Clear IRB::Color escape sequence before newline
because otherwise prompt and other things could be polluted.
2019-05-25 07:49:15 -07:00
Takashi Kokubun
e2db9f4cc3
Add and use Reline::Unicode.escape_for_print 2019-05-25 07:10:09 -07:00
Takashi Kokubun
e691b4da5d
Respect --nocolorize on REPL source highlight 2019-05-25 06:31:13 -07:00
Takashi Kokubun
061c781a09
Drop method obsoleted by b83119be9e
We might need to do the same thing in IRB::Color now, but I'm not doing
that as I assume ANSI escape sequence does not come from a user input
though Reline.
2019-05-25 00:38:19 -07:00