diff options
author | aycabta <[email protected]> | 2021-03-23 21:43:39 +0900 |
---|---|---|
committer | aycabta <[email protected]> | 2021-03-24 15:43:27 +0900 |
commit | 758f2b35f93478c481902d9d3f8876216a5dcc4d () | |
tree | 6d6515fbe13f246f503c1c5147d8eba4dce2f30b | |
parent | 4b33d860e84f0a5efeefbf8a68324801a0215a08 (diff) |
[ruby/reline] Support preposing and postposing for Reline.completion_proc
https://.com/ruby/reline/commit/1f469de90c
-rw-r--r-- | lib/reline/line_editor.rb | 34 | ||||
-rw-r--r-- | test/reline/test_string_processing.rb | 54 |
2 files changed, 86 insertions, 2 deletions
@@ -1158,8 +1158,25 @@ class Reline::LineEditor def call_completion_proc result = retrieve_completion_block(true) - slice = result[1] - result = @completion_proc.(slice) if @completion_proc and slice Reline.core.instance_variable_set(:@completion_quote_character, nil) result end @@ -1264,6 +1281,19 @@ class Reline::LineEditor end target = before end [preposing.encode(@encoding), target.encode(@encoding), postposing.encode(@encoding)] end @@ -20,4 +20,58 @@ class Reline::LineEditor::StringProcessingTest < Reline::TestCase width = @line_editor.send(:calculate_width, "\1\e[31m\2RubyColor\1\e[34m\2 default string \1\e[m\2>", true) assert_equal('RubyColor default string >'.size, width) end end |