diff --git a/repline/src/editor.rs b/repline/src/editor.rs index 903028b..0bbc1bf 100644 --- a/repline/src/editor.rs +++ b/repline/src/editor.rs @@ -26,8 +26,8 @@ pub struct Editor<'a> { tail: VecDeque, pub color: &'a str, - begin: &'a str, - again: &'a str, + pub begin: &'a str, + pub again: &'a str, } impl<'a> Editor<'a> { diff --git a/repline/src/repline.rs b/repline/src/repline.rs index dbfc714..49102a9 100644 --- a/repline/src/repline.rs +++ b/repline/src/repline.rs @@ -51,6 +51,14 @@ impl<'a, R: Read> Repline<'a, R> { pub fn set_color(&mut self, color: &'a str) { self.ed.color = color } + + /// Set the entire terminal prompt sequence + pub fn set_prompt(&mut self, color: &'a str, begin: &'a str, again: &'a str) { + self.ed.color = color; + self.ed.begin = begin; + self.ed.again = again; + } + /// Append line to history and clear it pub fn accept(&mut self) { self.history_append(self.ed.to_string());