Commit graph

650 commits

Author SHA1 Message Date
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
e6429ad047 [ruby/reline] Backspace and C-h should be unassigned on vi command mode
28f4dae020
2020-12-05 02:58:58 +09:00
aycabta
853c176ea7 [ruby/reline] Version 0.1.7
710ca23427
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
Yusuke Endoh
76cac4c05a [ruby/reline] Improve the performance of get_mbchar_width
It is about three times faster to use one big regexp instead of
sequential matching.

e36f6c0707
2020-12-05 02:58:58 +09:00
aycabta
b3e0db8060 [ruby/reline] Version 0.1.6
20a7806815
2020-12-05 02:58:58 +09:00
Yusuke Endoh
9461cceb8a [ruby/reline] Update the generator script too
8b0926820a
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
Yusuke Endoh
6a51d393ca [ruby/reline] Improve the regexps for EastAsianWidth
A character class is about three times faster than Regexp alternatives

57c7955c55
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
e16e481385 [ruby/reline] Use yamatanooroti 0.0.6 for supporting startup_message on Windows
167423b664
2020-12-05 02:58:58 +09:00
aycabta
87f51c7e66 [ruby/reline] Use startup_option instead of startup wait
a63ce6371c
2020-12-05 02:58:58 +09:00
aycabta
d5cf3fcd68 [ruby/reline] Update to Unicode 13.0.0
d49bb0aa34
2020-12-05 02:58:58 +09:00
aycabta
3a3e933033 [ruby/reline] Version 0.1.5
c8a419beb5
2020-09-14 02:12:12 +09:00
aycabta
ae508633b7 Suppress "assigned but unused variable" warning 2020-09-12 10:07:18 +09:00
aycabta
777d536749 [ruby/reline] Support for word movement escape sequences in iTerm2
187235f88c
2020-09-12 08:35:52 +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
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
Yoshinao Muramatu
a840ef8569 [ruby/reline] not clear scrollback buffer
ba800f1461
2020-09-12 08:35:51 +09:00
Yoshinao Muramatu
0862744010 [ruby/reline] clear_screen use Windows API
2c5ee54cb3
2020-09-12 08:35:51 +09:00
aycabta
770e66030a [ruby/reline] Use str.encoding by default for split_by_width
2d32604c9e
2020-09-12 08:35:51 +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
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
Nobuyoshi Nakada
f2435c1508 [ruby/reline] Get rid of loading pathname unnecessarily
9bd54b7f1c
2020-08-18 19:09:58 +09:00
Maciej Mensfeld
d1b06229fa [ruby/reline] Use the standard SPDX ID for license in gemspec
It is better to use SPDX ID for license field:

https://guides.rubygems.org/specification-reference/#license=

ref: https://spdx.org/licenses/Ruby.html
8468a727e5
2020-08-18 19:09:43 +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
aycabta
80a7358cfc [ruby/reline] Keep original characters in inputrc
96583c6336
2020-08-18 19:08:40 +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
568615d395 [ruby/reline] Use single quotes for non-expanded string literals
3bf7c7d722
2020-08-18 19:08:11 +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
f56e05fa7d [ruby/reline] Remove unnecessary TODO commnet
23c67fb7b3
2020-05-17 19:26:53 +09:00
aycabta
fc2a121c7c [ruby/reline] If history-size isn't numeric, it should be 500
https://tiswww.case.edu/php/chet/readline/readline.html#IDX25

> If an attempt is made to set history-size to a non-numeric value, the maximum
> number of history entries will be set to 500.

acf0437280
2020-05-17 19:26:53 +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
009092b04c [ruby/reline] Add URL reference of history-size
13420197b8
2020-04-29 19:13:14 +09:00
aycabta
213ebec7a7 [ruby/reline] Version 0.1.4
298144b06a
2020-04-29 19:13:14 +09:00
aycabta
4859352df6 [ruby/reline] Negative history_size means unlimited
And unlimited is default.

f5149c3ca6
2020-04-29 19:13:14 +09:00
aycabta
d27fa87418 [ruby/reline] New items to history are dropped if history_size is zero
9bdbed9cbc
2020-04-29 19:13:14 +09:00
Nobuyoshi Nakada
0ac5009165 [ruby/reline] Ignore non-absolute XDG_CONFIG_HOME
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
> All paths set in these environment variables must be absolute.
> If an implementation encounters a relative path in any of these
> variables it should consider the path invalid and ignore it.

45af6eea77
2020-04-29 19:13:14 +09:00
aycabta
9fb20711fd [ruby/reline] Treat home dir correctly
9b1327d2f4
2020-04-24 16:46:36 +09:00
aycabta
81b0b79197 [ruby/reline] Support XDG_CONFIG_HOME
In the XDG Specification, if ~/.config/readline/inputrc exists, then ~/.inputrc
should not be read, but for compatibility with GNU Readline, if ~/.inputrc
exists, then it is given priority.

97f1e7db04
2020-04-24 16:45:07 +09:00