liner icon indicating copy to clipboard operation
liner copied to clipboard

ability to not process keys

Open ghost opened this issue 6 years ago • 1 comments

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.

ghost avatar Jan 02 '19 09:01 ghost

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 ?

ngirard avatar Aug 15 '19 21:08 ngirard