Skip to content

User hook called when menu-complete displays a completion? #12

@dandavison

Description

@dandavison

Is there any way to execute user code each time menu-complete displays the next completion?

E.g. in the script below, if I hit tab repeatedly, it cycles through displaying "a" and "b". I would like some of my python code to execute when it displays "a", and when it displays "b".

import rl

def complete(text):
    return ['a', 'b']

rl.completer.parse_and_bind('tab: menu-complete')
rl.completer.completer = rl.generator(complete)
raw_input()

In the readline C code I see, e.g. a call to display_matches (which itself calls rl_completion_display_matches_hook) in rl_menu_complete, but I am not entirely sure whether what I want is possible and wanted to check.

Thanks!

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