repline: Make begin and again post-customizable, and once again fall out of sync
This commit is contained in:
parent
e0eb0d5a02
commit
06ed0eae54
@ -26,8 +26,8 @@ pub struct Editor<'a> {
|
||||
tail: VecDeque<char>,
|
||||
|
||||
pub color: &'a str,
|
||||
begin: &'a str,
|
||||
again: &'a str,
|
||||
pub begin: &'a str,
|
||||
pub again: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Editor<'a> {
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user