Skip to content

Pyreadline doesn't properly handle parenthesis #35

Description

@Rudedog9d

It looks like pyreadline doesn't properly handle a parenthesis when using readline.get_begidx() and readline.get_endidx(). This manifests when trying to tab complete an option that contain a parenthesis, ex:

# Create a new macro with a paren
macro test(
Beginning macro, use the 'end' command to save.
> echo hello world
> end
# tab complete showing them
macro --show test(<TAB> # all macros will be tab completed

The problem for us is inside shell.py:complete():

            # begidx and endidx are set to the same, 
            # so prefix is set to an empty string and passed to the completer
            begidx = readline.get_begidx()
            endidx = readline.get_endidx()
            line = readline.get_line_buffer()
            prefix = line[begidx:endidx] if line else ''
            line = line[:endidx]
            self.completion_matches = self.get_completions(line, prefix)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions