aboutsummaryrefslogtreecommitdiffstats
path: root/src/linebuf.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/linebuf.rs')
-rw-r--r--src/linebuf.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/linebuf.rs b/src/linebuf.rs
index 86c4f95..f5bd95f 100644
--- a/src/linebuf.rs
+++ b/src/linebuf.rs
@@ -61,6 +61,14 @@ impl LineBuf {
n
}
+ pub fn get_left(&self) -> Option<u8>{
+ self.pre.last().cloned()
+ }
+
+ pub fn get_right(&self) -> Option<u8>{
+ self.post.last().cloned()
+ }
+
pub fn add(&mut self, chr: u8) {
self.dirty = true;
self.pre.push(chr);
@@ -108,6 +116,10 @@ impl LineBuf {
self.dirty = false;
}
+ pub fn display_pre(&self) {
+ std::io::stdout().write_all(&self.pre).unwrap();
+ }
+
/// TODO: kinda ugly that this is here
pub fn display_post(&self, post: &[u8]) {
for &x in self.post.iter().rev() {