aboutsummaryrefslogtreecommitdiffstats
path: root/src/linebuf.rs
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-03-06 21:18:01 +0100
committerJonas Maier <jonas@x77.dev>2026-03-06 21:18:01 +0100
commit98900bed263b696553581974f719b02855911637 (patch)
tree30cc8b4d837de2a2fafcded013d1712f5cf11b32 /src/linebuf.rs
parent41dbb877cade868137360d2e676f4c2ad4594317 (diff)
downloadpish-98900bed263b696553581974f719b02855911637.tar.gz
Ctrl+A and Ctrl+E to move between the begin and end of line
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 836cfee..86c4f95 100644
--- a/src/linebuf.rs
+++ b/src/linebuf.rs
@@ -49,6 +49,18 @@ impl LineBuf {
}
}
+ pub fn all_left(&mut self) -> usize {
+ let n = self.pre.len();
+ while self.left() {}
+ n
+ }
+
+ pub fn all_right(&mut self) -> usize {
+ let n = self.post.len();
+ while self.right() {}
+ n
+ }
+
pub fn add(&mut self, chr: u8) {
self.dirty = true;
self.pre.push(chr);