From 8010b8c0ab90f2b3cea3ac8057128e5893160eb4 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 21 Oct 2022 13:50:20 -0600 Subject: [PATCH] Implement left/right --- src/buffer.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index 2a743ce..24efab1 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -413,10 +413,24 @@ impl<'a> TextBuffer<'a> { } }, TextAction::Left => { - todo!("left"); + let rtl_opt = self.lines[self.cursor.line.get()].shape_opt.as_ref().map(|shape| shape.rtl); + if let Some(rtl) = rtl_opt { + if rtl { + self.action(TextAction::Next); + } else { + self.action(TextAction::Previous); + } + } }, TextAction::Right => { - todo!("right"); + let rtl_opt = self.lines[self.cursor.line.get()].shape_opt.as_ref().map(|shape| shape.rtl); + if let Some(rtl) = rtl_opt { + if rtl { + self.action(TextAction::Previous); + } else { + self.action(TextAction::Next); + } + } }, TextAction::Up => { todo!("up");