Граф коммитов

28 Коммитов

Автор SHA1 Сообщение Дата
ima1zumi 218a8d8ef1 [ruby/reline] Remove unused method
(https://github.com/ruby/reline/pull/557)

`get_mbchar_byte_size_by_first_char` isn't used in Reline.
Also, this method implements the same functionality as `String#bytesize` and is unnecessary.
2023-06-22 17:07:23 +00:00
Stan Lo 02ecdf85c5 [ruby/reline] Drop Unicode.take_range's optional arg as it's never
used
(https://github.com/ruby/reline/pull/528)

https://github.com/ruby/reline/commit/428fed4a6a
2023-03-29 10:20:29 +00:00
tomoya ishida e26908dc4b [ruby/reline] Improve OSC sequence regexp. OSC sequence can end with
ST(ESC\) and it should not to include \a and \e inside.
(https://github.com/ruby/reline/pull/527)

https://github.com/ruby/reline/commit/a88052adec
2023-03-29 06:54:08 +00:00
Stan Lo 1e9a218ade [ruby/reline] Expand the scanned array to later case statement more
straightforward
(https://github.com/ruby/reline/pull/526)

* Improve test coverage on Unicode.take_range

* Add test for Unicode.calculate_width

* Expand the scanned array to later case statement more straightforward
2023-03-28 12:49:49 +00:00
tomoya ishida 60ca800d4f [ruby/reline] Fix split_by_width to retain color sequences
(https://github.com/ruby/reline/pull/490)

* Fix split_by_width to retain color sequences

* Add OSC escape sequence testcase of Reline::Unicode.split_by_width
2023-03-25 15:01:35 +00:00
aycabta 726cc8122e [ruby/reline] "Halfwidth char + halfwidth (han)dakuten" is a single grapheme.
When a halfwidth character is followed by a halfwidth dakuten or a
halfwidth handakuten character, it should be treated as a single
grapheme.

https://github.com/ruby/reline/commit/9f20b9ec28
2021-12-24 00:51:47 +09:00
aycabta e68a586263 [ruby/reline] Add that Reline::Unicode.take_range is cutting based on width
https://github.com/ruby/reline/commit/18405d9594
2021-09-06 05:22:36 +09:00
aycabta 1fe604a675 [ruby/reline] Add comments about optimizing chars in ASCII range of UTF-8
https://github.com/ruby/reline/commit/3c13d93486
2021-09-06 05:22:29 +09:00
aycabta c8a07a1231 [ruby/reline] Fix Reline::Unicode.take_range as it was not fully functional
https://github.com/ruby/reline/commit/5da6a8d851
2021-08-31 15:19:32 +09:00
aycabta fb0fc20196 [ruby/reline] Implement dialog with autocomplete callback
https://github.com/ruby/reline/commit/1401d6165e
2021-08-29 20:30:32 +09:00
aycabta dc9e33016c [ruby/reline] Return 1 when char width not found
This fixes ruby/reline#261.

https://github.com/ruby/reline/commit/3cf1213014
2021-02-21 06:41:03 +09:00
aycabta 9a7647d9eb [ruby/reline] Doesn't contain terminate spaces by cw
This closes ruby/reline#233.

https://github.com/ruby/reline/commit/4c3f2e2eae
2020-12-24 23:26:22 +09:00
aycabta 0db9842b2c [ruby/reline] Delete the last char of a line by dw
This closes ruby/reline#229.

https://github.com/ruby/reline/commit/3f0ae689c4
2020-12-24 23:26:22 +09:00
aycabta fb2fda9a27 [ruby/reline] Optimize regexp handling for width
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"

0.47sec -> 0.34sec

  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"

0.11sec -> 0.08sec

  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.40sec -> 0.33sec

Co-authored-by: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/reline/commit/a9e39ddcc4
2020-12-05 02:58:59 +09:00
aycabta 3d0bcf1cc2 [ruby/reline] Optimize ASCII character width calculation
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"

0.73sec -> 0.43sec

  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"

0.15sec -> 0.10sec

  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.59sec -> 0.38sec

Co-authored-by: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/reline/commit/36bc9e3abb
2020-12-05 02:58:59 +09:00
manga_osyo e47e5db889 [ruby/reline] Fix crash to input `é`. refs #174
https://github.com/ruby/reline/commit/ba5e267e5f
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.

https://github.com/ruby/reline/commit/e36f6c0707
2020-12-05 02:58:58 +09:00
aycabta 770e66030a [ruby/reline] Use str.encoding by default for split_by_width
https://github.com/ruby/reline/commit/2d32604c9e
2020-09-12 08:35:51 +09:00
aycabta 1f09c43628 [ruby/reline] Move width calculator methods to Reline::Unicode
https://github.com/ruby/reline/commit/f348ecd9f5
2020-08-28 11:05:18 +09:00
aycabta 4b7213a85a Implement transpose-words 2019-06-04 07:23:36 +09:00
aycabta 3428922437 The ed_move_to_beg is different from vi_first_print 2019-06-03 03:29:34 +09: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 e2db9f4cc3
Add and use Reline::Unicode.escape_for_print 2019-05-25 07:10:09 -07:00
aycabta 17350c7e55 Add Reline as a fallback library for Readline
* lib/reine.rb, lib/reline/*: Reline is a readline stdlib compatible
  library.
* lib/readline.rb: Readline uses a fallback to Reline when ext/readline
  doesn't exist.
* tool/sync_default_gems.rb: add ruby/reline as a default gem.
* appveyor.yml: add "set RELINE_TEST_ENCODING=Windows-31J" for test suit
  of Reline, and add "--exclude readline" to "nmake test-all" on Visual
  Studio builds because of strange behavior.
* spec/ruby/library/readline/spec_helper.rb: skip Reline as with
  RbReadline.
2019-04-30 11:44:20 +09:00
Nobuyoshi Nakada f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta 51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00
aycabta 7f273ac6d0 IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 08:51:20 +00:00