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

ability to not process keys #91

Open
ghost opened this issue Jan 2, 2019 · 1 comment
Open

ability to not process keys #91

ghost opened this issue Jan 2, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 2, 2019

deny processing of inputs by boolean result, basically:

use liner::{Event, Context};
use termion::event::Key;

fn main() {
    let mut line = Context::new();

    line.read_line("$ ", &mut |Event {editor, kind}| -> bool {
        match kind {
            EventKind::BeforeKey(Key::Char(c)) => !c.is_whitespace(),
            _ => true
        }
    });
}

output:

./target/release/liner-test
$ 
# <SPACE> <SPACE> <SPACE> <SPACE>
$ 
# <SPACE> <SPACE> <SPACE> a <SPACE> b <SPACE> c <SPACE>
$ abc

i accomplished this currently, and terribly with Editor::undo.

@ngirard
Copy link

ngirard commented Aug 15, 2019

This project seems to be abandoned.

Could you please raise an issue on https://gitlab.redox-os.org/redox-os/liner , then close this one ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant