Commit graph

222 commits

Author SHA1 Message Date
aycabta
7e93917458 [ruby/reline] Reset @rest_height when clear screen
3a7019b0d5
2021-04-02 17:33:48 +09:00
aycabta
89caf51d93 [ruby/reline] Suppress crashing when completer_{quote,word_break}_characters is empty
c6f1164942
2021-03-24 15:43:34 +09:00
aycabta
758f2b35f9 [ruby/reline] Support preposing and postposing for Reline.completion_proc
1f469de90c
2021-03-24 15:43:27 +09:00
aycabta
4b33d860e8 [ruby/reline] Reline.delete_text removes the current line in multiline
da90c094a1
2021-03-24 15:43:19 +09:00
aycabta
aeac4ddcc0 [ruby/reline] Use UTF-8 only for width calc, rest uses original encoding
I confirmed that libvterm supports only which are UTF-8, US ASCII, UK, and
DEC graphics by reading source code, so can't test this patch by
yamatanoorogi gem through vterm gem for now.

This fixes ruby/irb#190.

44596c0cc7
2021-02-21 06:44:05 +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
Yoshinao Muramatu
38cefac7ce [ruby/reline] We still need support new and legacy behavior.
Revert "Support for change in Windows-specific behavior at eol"

This reverts commit cad4de6ee841b43f3f0e441626f9415c3eda0f82.

646587fc2c
2021-02-21 06:43:41 +09:00
Eamonn Webster
ac9e3b514b [ruby/reline] Avoid tripping over nil prompt
d4d9d3e3d4
2021-02-21 06:41:11 +09:00
aycabta
300084a854 [ruby/reline] Terminate correctly in the middle of lines higher than the screen
e1d9240ada
2021-02-07 05:12:19 +09:00
aycabta
fee19da230 [ruby/reline] Autowrap correctly when inserting chars in the middle of a line
ebaf37255f
2021-02-07 05:12:07 +09:00
aycabta
a19ed1623f [ruby/reline] The vi_histedit supports multiline
This closes ruby/reline#253.

f131f86d71
2021-02-07 05:11:54 +09:00
aycabta
a608bb3e9b [ruby/reline] Move cursor just after the last line when finished
ba06e4c480
2021-02-07 05:11:47 +09:00
aycabta
08162f0e69 [ruby/reline] Update cursor info by inserting newline even if not in pasting
92d314f514
2021-02-07 05:11:41 +09:00
aycabta
b371ca3f4f [ruby/reline] Handle past logs correctly when the code is higher than the screen
f197139b4a
2021-02-07 05:11:27 +09:00
aycabta
bd0f8b36fd [ruby/reline] Show all lines higher than the screen when finished
On Unix-like OSes, logs prior to the screen are not editable. When the code
is higher than the screen, the code is only shown on the screen until input
is finished, but when it is finished, all lines are outputted.

8cd9132a39
2021-02-07 05:11:13 +09:00
aycabta
03523fdafb [ruby/reline] Scroll down when ^C is pressed
6877a7e3f5
2021-02-07 05:11:00 +09:00
aycabta
ec6929a5dd [ruby/reline] Remove an unused variable
123ea51166
2021-02-07 05:10:50 +09:00
aycabta
433b975fe8 [ruby/reline] Initialize uninitialized variables in tests
25af4bb64b
2021-02-07 05:10:36 +09:00
aycabta
b69c965f47 [ruby/reline] Cache pasting state in processing a key
Because it's too slow.

The rendering time in IRB has been reduced as follows:

  start = Time.now

  def each_top_level_statement
    initialize_input
    catch(:TERM_INPUT) do
      loop do
        begin
          prompt
          unless l = lex
            throw :TERM_INPUT if @line == ''
          else
            @line_no += l.count("\n")
            next if l == "\n"
            @line.concat l
            if @code_block_open or @ltype or @continue or @indent > 0
              next
            end
          end
          if @line != "\n"
            @line.force_encoding(@io.encoding)
            yield @line, @exp_line_no
          end
          break if @io.eof?
          @line = ''
          @exp_line_no = @line_no

          @indent = 0
        rescue TerminateLineInput
          initialize_input
          prompt
        end
      end
    end
  end

  puts "Duration: #{Time.now - start} seconds"

0.22sec -> 0.14sec

b8b3dd52c0
2021-02-07 05:09:18 +09:00
aycabta
05df7e0d4a [ruby/reline] Support for change in Windows-specific behavior at eol
The behavior of automatically moving the cursor to the next line when
displaying a char at the eol on Windows suddenly disappeared.

cad4de6ee8
2021-01-18 02:09:43 +09:00
aycabta
1aba1a5103 [ruby/reline] Initialize a variable just in case
29b10f6e98
2021-01-18 02:07:37 +09:00
aycabta
eb5a094fc0 [ruby/reline] Move the cursor correctly when deleting at eol
This fixes ruby/reline#246.

07a73ba601
2021-01-13 01:12:54 +09:00
aycabta
44817db28b [ruby/reline] Handle ed_search_{prev,next}_history in multiline correctly
The current line was being handled incorrectly when displaying the hit
history, so it has been fixed to be correct.

a3df4343b3
2021-01-13 01:12:54 +09:00
aycabta
01235f800f [ruby/reline] Suppress auto indent for adding newlines in pasting
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

074bb017a7
2021-01-08 13:25:18 +09:00
aycabta
76c9a3c8c6 [ruby/reline] Suppress crashing when dynamic_prompt_proc returns a broken prompt list
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

558f7be168
2021-01-08 13:25:18 +09:00
aycabta
88af5085db [ruby/reline] Suppress crashing when auto_indent_proc returns broken indent info
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

7c24276275
2021-01-08 13:25:18 +09:00
aycabta
ea75aed98e [ruby/reline] Correct var names in Reline were different from vi-*-mode-string
8255fc93b9
2021-01-08 13:25:18 +09:00
aycabta
54c1dcba2b [ruby/reline] Update cursor correctly when just cursor moving
This fixes ruby/reline#236 and ruby/reline#239.

3e3c89d00b
2021-01-08 13:25:18 +09:00
aycabta
9a7647d9eb [ruby/reline] Doesn't contain terminate spaces by cw
This closes ruby/reline#233.

4c3f2e2eae
2020-12-24 23:26:22 +09:00
aycabta
78421319d0 [ruby/reline] Use #bytesize for vi_replace_char
This closes ruby/reline#228.

8205fa0b00
2020-12-24 23:26:22 +09:00
aycabta
8d5d139afa [ruby/reline] Suppress crashing when boken prompt_list is given
922d087e7a
2020-12-24 23:26:22 +09:00
aycabta
634b231f33 [ruby/reline] Discard prompt cache by changing mode icon
bfeda8a79b
2020-12-24 23:26:22 +09:00
aycabta
b52bc4a9c2 [ruby/reline] Support isearch-terminators
a7922da16b
2020-12-22 23:45:43 +09:00
aycabta
294552ca6c [ruby/reline] Render refreshed prompt just after i-search finished
0d3188fe34
2020-12-22 23:45:43 +09:00
aycabta
c2a5594e27 [ruby/reline] Use cached prompt list when just moved the cursor
cfe619460b
2020-12-19 02:12:11 +09:00
aycabta
d4257c6152 [ruby/reline] Yank by em-kill-region correctly
This closes ruby/reline#106.

2549a52e15
2020-12-19 02:12:11 +09:00
aycabta
af2c81e10c [ruby/reline] Bind yank-pop correctly
3c74beac65
2020-12-19 02:12:11 +09:00
aycabta
2b8fa78176 [ruby/reline] Support longer than screen height
e83a3de9ed
2020-12-17 20:14:59 +09:00
Yale Kozinski
d597d7a8b6 Fixing glitchy kill ring behavior in irb
See https://github.com/ruby/irb/issues/85 for details
2020-12-17 20:04:42 +09:00
ima1zumi
68d3952c52 [ruby/reline] Fix breaking to input Emoji with ZWJ.
f21dfdbb11
2020-12-11 23:08:06 +09:00
aycabta
3bf7b999e5 [ruby/reline] Editing to initial content is not just cursor moving
0a4f175b0a
2020-12-08 00:08:41 +09:00
aycabta
0cf073088e [ruby/reline] Process insertion buffer forcibly
89d49ec9e0
2020-12-05 02:58:59 +09:00
aycabta
7624f52757 [ruby/reline] Forced newline insertion is not just cursor moving
0e30a49d03
2020-12-05 02:58:59 +09:00
aycabta
37a574b527 [ruby/reline] Drop prompt list cache when num of lines is changed
1959e22043
2020-12-05 02:58:59 +09:00
aycabta
2910684c45 [ruby/reline] Cache dynamic prompt for 0.5sec
06b89d0e61
2020-12-05 02:58:59 +09:00
aycabta
b763c5cdf0 [ruby/reline] Stop rerendering if the cursor is only moved
30e8eaf855
2020-12-05 02:58:59 +09:00
aycabta
a297565a4e [ruby/reline] Split #rerender method that is too huge
d0fbc89253
2020-12-05 02:58:59 +09:00
aycabta
b545ab219b [ruby/reline] Stop rerendering whole screen when adding newline at end of buffer
The rendering time in IRB has been reduced as follows:

  start = Time.now

  def each_top_level_statement
    initialize_input
    catch(:TERM_INPUT) do
      loop do
        begin
          prompt
          unless l = lex
            throw :TERM_INPUT if @line == ''
          else
            @line_no += l.count("\n")
            next if l == "\n"
            @line.concat l
            if @code_block_open or @ltype or @continue or @indent > 0
              next
            end
          end
          if @line != "\n"
            @line.force_encoding(@io.encoding)
            yield @line, @exp_line_no
          end
          break if @io.eof?
          @line = ''
          @exp_line_no = @line_no

          @indent = 0
        rescue TerminateLineInput
          initialize_input
          prompt
        end
      end
    end
  end

  puts "Duration: #{Time.now - start} seconds"

0.33sec -> 0.22sec

496c6a1892
2020-12-05 02:58:59 +09:00
aycabta
c85035363f [ruby/reline] Key strokes like 2dl should behave d2l
Key strokes, vi arg, operator, and motion should be treated as operator, vi
arg, and motion.

d1a7e74aa4
2020-12-05 02:58:58 +09:00
aycabta
dbfc1f30d5 [ruby/reline] Add alias vi-movement-mode to vi-command-mode for compatibility
a79c297567
2020-12-05 02:58:58 +09:00