Commit graph

350 commits

Author SHA1 Message Date
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
aycabta
48742614df [ruby/reline] Move alias_method to right after original definition
b7c8b93fa9
2020-12-05 02:58:58 +09:00
aycabta
9750c27afc [ruby/reline] Call process_insert when the end of pasting plural fullwidth chars
594484d9f9
2020-12-05 02:58:58 +09:00
aycabta
ba8e5f77eb [ruby/reline] Motions e, E, t, f should include a char on cursor if follows operator
86e9a76499
2020-12-05 02:58:58 +09:00
aycabta
6be3b2da19 [ruby/reline] Implement vi_yank
164aaf9a5f
2020-12-05 02:58:58 +09:00
aycabta
2dc4aca8d1 [ruby/reline] Operator with arg need to make sure that they take arg to avoid crashing
1c0c06de1f
2020-12-05 02:58:58 +09:00
aycabta
92b22db6a7 [ruby/reline] Unimplemented vi command should be no-op
abc90e6867
2020-12-05 02:58:58 +09:00
aycabta
faf8f216be [ruby/reline] Keep operator proc as a local variable in the scope
The proc variable will be used later so the instance variable will be changes.

496c4361f6
2020-12-05 02:58:58 +09:00
aycabta
564aadce62 [ruby/reline] Skip em_exchange_mark without mark
abb56e5ec3
2020-12-05 02:58:58 +09:00
aycabta
266ffdde8e [ruby/reline] Continuous insertion buffering
The rendering time in IRB has been reduced as follows:

  start = Time.now

  [{"_id"=>"5f9072a4589a06d2d74b6028",
    "index"=>0,
    "guid"=>"6b3051e2-dbc7-4537-bdb9-6cd7bb5358a7",
    "isActive"=>true,
    "balance"=>"$1,442.84",
    "picture"=>"http://placehold.it/32x32",
    "age"=>34,
    "eyeColor"=>"blue",
    "name"=>{"first"=>"Ward", "last"=>"Levy"},
    "company"=>"HYPLEX",
    "email"=>"ward.levy@hyplex.us",
    "phone"=>"+1 (867) 568-3319",
    "address"=>"867 Cobek Court, Clara, Maryland, 3254",
    "about"=>
     "Exercitation eu ex aliqua sit. Pariatur aliquip incididunt sint id non consectetur ullamco Lorem ea mollit duis amet sint labore. Commodo laborum labore commodo officia in cillum adipisicing esse excepteur cupidatat adipisicing ut. Non esse incididunt voluptate aliquip cillum eu aute duis laboris sit et. Amet enim quis tempor occaecat excepteur exercitation excepteur deserunt amet cillum adipisicing.",
    "registered"=>"Monday, May 25, 2015 6:51 AM",
    "latitude"=>"16.001127",
    "longitude"=>"-72.377848",
    "tags"=>["dolore", "nostrud", "occaecat", "cillum", "nisi"],
    "range"=>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    "friends"=>
     [{"id"=>0, "name"=>"Alison Bryant"},
      {"id"=>1, "name"=>"Ester Espinoza"},
      {"id"=>2, "name"=>"Sullivan Kane"}],
    "greeting"=>"Hello, Ward! You have 7 unread messages.",
    "favoriteFruit"=>"apple"}]

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

2.17sec -> 0.92sec

  start = Time.now

  "Exercitation eu ex aliqua sit. Pariatur aliquip incididunt sint id non consectetur ullamco Lorem ea mollit duis amet sint labore. Commodo laborum labore commodo officia in cillum adipisicing esse excepteur cupidatat adipisicing ut. Non esse incididunt voluptate aliquip cillum eu aute duis laboris sit et. Amet enim quis tempor occaecat excepteur exercitation excepteur deserunt amet cillum adipisicing."

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

1.57sec -> 0.22sec

  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.88sec -> 0.77sec

7d87ac5a12
2020-12-05 02:58:58 +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
4af2e4111b [ruby/reline] Deduplicate completed items
2dabf0c786
2020-12-05 02:58:58 +09:00
aycabta
f36dc2b6de [ruby/reline] Treat prompt correctly when Reline.prompt_proc isn't set
9c9ba0eff3
2020-09-12 08:35:52 +09:00
aycabta
ce389ade45 [ruby/reline] Move cursor to currect vertical pos after rendering a logical line
9b932df544
2020-09-12 08:35:52 +09:00
aycabta
9baf1bd0a4 [ruby/reline] Stop using chomp option of lines method
3e2f55c3e0
2020-09-12 08:35:52 +09:00
aycabta
0ec19cc843 [ruby/reline] Stop erasing chars after the cursor at eol
When the cursor is at the end of the line and erases characters after the
cursor, some terminals delete the character at the cursor position.

e96ec97b02
2020-09-12 08:35:52 +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
Nobuyoshi Nakada
f2435c1508 [ruby/reline] Get rid of loading pathname unnecessarily
9bd54b7f1c
2020-08-18 19:09:58 +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
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
f56e05fa7d [ruby/reline] Remove unnecessary TODO commnet
23c67fb7b3
2020-05-17 19:26:53 +09:00