aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index a92a594..4e9a4e9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,13 +11,21 @@ use crate::error::{ CalcError, handler };
11 11
12use rustyline::error::ReadlineError; 12use rustyline::error::ReadlineError;
13use rustyline::Editor; 13use rustyline::Editor;
14use rustyline::config::{ Config, Builder, ColorMode, EditMode };
14 15
15fn main() { 16fn main() {
16let mut rl = Editor::<()>::new(); 17 let config_builder = Builder::new();
18 let config = config_builder.color_mode(ColorMode::Enabled)
19 .edit_mode(EditMode::Emacs)
20 .history_ignore_space(true)
21 .max_history_size(1000)
22 .build();
23 let mut rl = Editor::<()>::with_config(config);
17 if rl.load_history("history.txt").is_err() { 24 if rl.load_history("history.txt").is_err() {
18 println!("No previous history."); 25 println!("No previous history.");
19 } 26 }
20 'main: loop { 27
28 loop {
21 let readline = rl.readline("> "); 29 let readline = rl.readline("> ");
22 match readline { 30 match readline {
23 Ok(line) => { 31 Ok(line) => {