From 6a3bc5b4823217fe54c3a3397165b95678354c0d Mon Sep 17 00:00:00 2001 From: gwenn <gtreguier@gmail.com> Date: Sun, 4 Sep 2016 11:40:28 +0200 Subject: [PATCH] Page completions --- examples/example.rs | 3 ++- src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/example.rs b/examples/example.rs index 18bf58b4..8d49697f 100644 --- a/examples/example.rs +++ b/examples/example.rs @@ -2,7 +2,7 @@ extern crate rustyline; use rustyline::completion::FilenameCompleter; use rustyline::error::ReadlineError; -use rustyline::{Config, Editor}; +use rustyline::{Config, CompletionType, Editor}; // On unix platforms you can use ANSI escape sequences #[cfg(unix)] @@ -16,6 +16,7 @@ static PROMPT: &'static str = ">> "; fn main() { let config = Config::builder() .history_ignore_space(true) + .completion_type(CompletionType::List) .build(); let c = FilenameCompleter::new(); let mut rl = Editor::new(config); diff --git a/src/lib.rs b/src/lib.rs index a3cd8ab2..214aff1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -672,6 +672,7 @@ fn page_completions<R: Read>(rdr: &mut tty::RawReader<R>, } _ => break, } + try!(write_and_flush(s.out, b"\n")); } else { try!(write_and_flush(s.out, b"\n")); } @@ -691,7 +692,8 @@ fn page_completions<R: Read>(rdr: &mut tty::RawReader<R>, } try!(write_and_flush(s.out, ab.as_bytes())); } - // TODO + try!(write_and_flush(s.out, b"\n")); + try!(s.refresh_line()); Ok(None) } -- GitLab