Skip to content

Update Reline core to stay in sync with the line_editor's completion_append_character #756

@sjanusz-r7

Description

@sjanusz-r7

Description

When updating Reline.completion_append_character in Reline.completion_proc, the change does not get reflected until you enter a new Reline.readline or Reline.readmultiline context. It seems like the value of Reline.completion_append_character and Reline.line_editor.completion_append_character is out of sync.

Scenario: We are updating the value of Reline.completion_append_character = ' ' inside of the completion_proc, but it's not reflecting in the line_editor

Expected Behaviour

Being able to change Reline.completion_append_character in the completion proc and have it update the line_editor.

i.e. this code:

reline/lib/reline.rb

Lines 83 to 93 in 7534f7f

def completion_append_character=(val)
if val.nil?
@completion_append_character = nil
elsif val.size == 1
@completion_append_character = val.encode(encoding)
elsif val.size > 1
@completion_append_character = val[0].encode(encoding)
else
@completion_append_character = nil
end
end

To immediately update the line_editor's completion_append_character value

    def completion_append_character=(val)
      if val.nil?
        @completion_append_character = nil
      elsif val.size == 1
        @completion_append_character = val.encode(encoding)
      elsif val.size > 1
        @completion_append_character = val[0].encode(encoding)
      else
        @completion_append_character = nil
      end
      # Ensure the line_editor is updated too:
      line_editor.completion_append_character = @completion_append_character
    end

Current Behaviour

Changing Reline.completion_append_character in Reline.completion_append_character does not take effect until a new call to Reline.readline.

Terminal Emulator

MacOS

Reline Version

0.5.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions