[前][次][番号順一覧][スレッド一覧]

ruby-changes:59293

From: Thomas <ko1@a...>
Date: Tue, 17 Dec 2019 15:47:21 +0900 (JST)
Subject: [ruby-changes:59293] a1713bedb1 (master): [ruby/reline] Implement completion_append_character

https://git.ruby-lang.org/ruby.git/commit/?id=a1713bedb1

From a1713bedb1de676fdd7d9bf3458b931c4702a1af Mon Sep 17 00:00:00 2001
From: Thomas Leitner <t_leitner@g...>
Date: Fri, 4 Oct 2019 10:03:32 +0200
Subject: [ruby/reline] Implement completion_append_character

There is already the possibility to set Reline.completion_append_character.
However, it is not used by the line editor.

https://github.com/ruby/reline/commit/ab798931b9

diff --git a/lib/reline.rb b/lib/reline.rb
index c4c6b97..9a9f742 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -212,6 +212,7 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L212
       end
       line_editor.output = output
       line_editor.completion_proc = completion_proc
+      line_editor.completion_append_character = completion_append_character
       line_editor.output_modifier_proc = output_modifier_proc
       line_editor.prompt_proc = prompt_proc
       line_editor.auto_indent_proc = auto_indent_proc
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 9d8185f..7b67687 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -10,6 +10,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L10
   attr_reader :byte_pointer
   attr_accessor :confirm_multiline_termination_proc
   attr_accessor :completion_proc
+  attr_accessor :completion_append_character
   attr_accessor :output_modifier_proc
   attr_accessor :prompt_proc
   attr_accessor :auto_indent_proc
@@ -58,6 +59,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L59
 
   def initialize(config)
     @config = config
+    @completion_append_character = ''
     reset_variables
   end
 
@@ -620,8 +622,8 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L622
         @completion_state = CompletionState::MENU
       end
       if target < completed
-        @line = preposing + completed + postposing
-        line_to_pointer = preposing + completed
+        @line = preposing + completed + completion_append_character.to_s + postposing
+        line_to_pointer = preposing + completed + completion_append_character.to_s
         @cursor_max = calculate_width(@line)
         @cursor = calculate_width(line_to_pointer)
         @byte_pointer = line_to_pointer.bytesize
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]