ruby / ruby/reline

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

Open Beginner friendly
#756 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ruby
Stars
311
Forks
99
Avg merge
6d 4h
Merged PRs (30d)
1

Description

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:

https://github.com/ruby/reline/blob/7534f7f92ad6ec5e38d7b404942cd7f30e3c1327/lib/reline.rb#L83-L93

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the completion_append_character= implementation in lib/reline.rb at the linked lines, then reproduce the issue by changing the value inside a completion_proc. Verify how Reline.line_editor stores the value and confirm that the line editor reflects the new setting immediately, without requiring another readline or readmultiline context.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.