1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
Thomas Leitner 2019-10-04 10:03:32 +02:00 committed by aycabta
parent 11db4d3a3b
commit a1713bedb1
2 changed files with 5 additions and 2 deletions

View file

@ -212,6 +212,7 @@ module Reline
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

View file

@ -10,6 +10,7 @@ class Reline::LineEditor
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
def initialize(config)
@config = config
@completion_append_character = ''
reset_variables
end
@ -620,8 +622,8 @@ class Reline::LineEditor
@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