Commit graph

350 commits

Author SHA1 Message Date
aycabta
4cd344c958 [ruby/reline] Add the ability to handle context between dialogs
063d9c70d9
2021-08-29 20:30:33 +09:00
aycabta
8d4370b066 [ruby/reline] Support for multiple dialog rendering
f589fab718
2021-08-29 20:30:33 +09:00
aycabta
164e486225 [ruby/reline] Remove @dialog_updown and @dialog_contents_width
458cb8a9cc
2021-08-29 20:30:33 +09:00
aycabta
4b2b10707a [ruby/reline] Implement dynamic selection of candidates
e46437df00
2021-08-29 20:30:33 +09:00
aycabta
fdc005e54e [ruby/reline] Completion journey starts with one of candidates
First one is just original string.

ccb70cc240
2021-08-29 20:30:33 +09:00
aycabta
475038a622 [ruby/reline] Move cursor correctly when current line is auto wrapped
14c8fade54
2021-08-29 20:30:33 +09:00
aycabta
ff43b0f2dd [ruby/reline] Update dialog backup before clearing
a39e2c8813
2021-08-29 20:30:33 +09:00
aycabta
ca1a2d1f68 [ruby/reline] Show autocomplete correctly when starts from prev line
f31a76ff31
2021-08-29 20:30:33 +09:00
aycabta
06bd48aba8 [ruby/reline] Remove unnecessary metadata between lines
83928249e3
2021-08-29 20:30:33 +09:00
aycabta
081e5de34d [ruby/reline] Combine vertical processing into @dialog_vertical_offset
600b93620c
2021-08-29 20:30:33 +09:00
aycabta
f863ed5210 [ruby/reline] Drop too much contents before processing
94f7027edc
2021-08-29 20:30:33 +09:00
aycabta
fb9fe4c43f [ruby/reline] Display autocomplete below original line if end point was wrapped
49f3392d59
2021-08-29 20:30:33 +09:00
aycabta
9b2afb2eed [ruby/reline] Scroll properly to create margin
064d54f8f1
2021-08-29 20:30:33 +09:00
aycabta
85dd0ad5e0 [ruby/reline] Move dialog pos to left when goes beyond right edge
f1efa2b062
2021-08-29 20:30:33 +09:00
aycabta
02a61fe33f [ruby/reline] Hide cursor when rendering dialog
a9050cf676
2021-08-29 20:30:32 +09:00
aycabta
c0349765e9 [ruby/reline] Remove debug code
2389d175f7
2021-08-29 20:30:32 +09:00
aycabta
2ec3977ce2 [ruby/reline] Clear after cursor
4d7503cd1f
2021-08-29 20:30:32 +09:00
aycabta
b95e5f4a41 [ruby/reline] Move cursor to rerender right margin of dialog correctly
554855013b
2021-08-29 20:30:32 +09:00
aycabta
6f66927aef [ruby/reline] Add comments about where rerendering
4406069b7e
2021-08-29 20:30:32 +09:00
aycabta
55459bdd67 [ruby/reline] Use background color instead of border frame
8f1db0a076
2021-08-29 20:30:32 +09:00
aycabta
6fda457448 [ruby/reline] Suppress warning; unused variable
74a6124e8d
2021-08-29 20:30:32 +09:00
aycabta
1e527c8a55 [ruby/reline] Remove an unnecessary variable
5435c1aa3f
2021-08-29 20:30:32 +09:00
aycabta
fb0fc20196 [ruby/reline] Implement dialog with autocomplete callback
1401d6165e
2021-08-29 20:30:32 +09:00
aycabta
e66200780b [ruby/reline] Separate calling completion proc with checking args
3203cb97db
2021-08-29 20:30:32 +09:00
aycabta
de93b8b069 Handle SIGINT in other thread correctly
Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-08-04 18:29:42 +09:00
aycabta
5bb7b57129 Use Symbol of signal for trap 2021-08-04 18:29:42 +09:00
aycabta
95a3cdade6 [ruby/reline] Remove FIXME comment in #render
acd8f8efbb
2021-06-21 17:58:49 +09:00
aycabta
b06218ce6f [ruby/reline] Remove TODO comment in #render_partial
bb6ea232c2
2021-06-21 17:58:49 +09:00
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