Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.lua: implement real-time fuzzy autocompletion #15364

Merged
merged 5 commits into from
Nov 23, 2024

Commits on Nov 23, 2024

  1. console.lua: determine completions with fuzzy search

    For example, set vo gn<Tab> will complete to gpu-next.
    guidocella committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    2d8af91 View commit details
    Browse the repository at this point in the history
  2. console.lua: complete fewer properties

    10k properties makes the console hang and the CPU fan spin with live
    fuzzy filtering, so print fewer sub-properties. These are rarely useful
    anyway.
    guidocella committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    aa6116b View commit details
    Browse the repository at this point in the history
  3. console.lua: show completions as you type

    Show available completion suggestions as you type without having to
    press Tab.
    
    This is fast even on a 2011 CPU, so we can get away with doing this in
    the same thread that draws the console. The one case where it could make
    the console hang is file completion of network drives, but in general it
    is convenient for loadfile.
    
    mp.input.get clients also get a request to complete on each character
    typed, but those run in a different thread so performance is always
    fine, and completions were already rejected if the input line or cursor
    changed after the request. If I ever make running mpv commands an
    mp.input client in the future, command completion will also benefit from
    running in a different thread.
    guidocella committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    e793688 View commit details
    Browse the repository at this point in the history
  4. console.lua: dont crash when typing a command prefix

    Typing a command prefix crashes console because first_useful_token is
    nil. This already happened before implementing autocompletion if you did
    no-osd<Tab>, but autocompletion made it evident.
    guidocella committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    d64fd00 View commit details
    Browse the repository at this point in the history
  5. console.lua: expand the first completion on Enter

    If you run a command without manually selecting a completion, select the
    first one. e.g. set vo gn runs set vo gpu-next.
    guidocella committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    d7886ec View commit details
    Browse the repository at this point in the history