Skip to content

Completions not working #307

@mcastorina

Description

@mcastorina

Platform linux
Terminal software rxvt-unicode

The example completions program compiles, runs, and displays a prompt. Typing a few characters then TAB or Ctrl+X does not complete the expected word or display a menu of possible completions. It appears to have the same behavior as without calling with_completions.

Steps to reproduce

[dependencies]
reedline = { git = "https://github.com/nushell/reedline", branch = "main" }

I did this today so I believe it's 8c565e4 though I don't know how to confirm this in the project.

use reedline::{DefaultCompleter, DefaultPrompt, Reedline, Signal};

fn main() {
    let prompt = DefaultPrompt::default();

    let commands = vec![
        "test".into(),
        "hello world".into(),
        "hello world reedline".into(),
        "this is the reedline crate".into(),
    ];
    let completer = Box::new(DefaultCompleter::new_with_wordlen(commands, 2));
    let mut line_editor = Reedline::create().unwrap().with_completer(completer);

    loop {
        let sig = line_editor.read_line(&prompt).unwrap();
        match sig {
            Signal::Success(buffer) => {
                println!("We processed: {}", buffer);
            }
            Signal::CtrlD | Signal::CtrlC => {
                println!("\nAborted!");
                break;
            }
            Signal::CtrlL => {
                line_editor.clear_screen().unwrap();
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CompletionsArea: Tab completion and inline hint completionsA-KeybindingEmacsArea: Handling of default (Emacs style) keybindingsdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions