From 54d08a0575361318556d3dbd067268fdeabd6186 Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Wed, 14 Aug 2024 21:36:17 -0400 Subject: [PATCH] swap ops --- parley/src/layout/cursor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parley/src/layout/cursor.rs b/parley/src/layout/cursor.rs index fcb4a801..a91f6be8 100644 --- a/parley/src/layout/cursor.rs +++ b/parley/src/layout/cursor.rs @@ -164,7 +164,7 @@ impl Cursor { /// /// Returns `None` if the cursor should remain in its current position. pub fn next_line(&self, layout: &Layout, h_pos: Option) -> Option { - move_to_line(layout, self, h_pos, self.path.line_index.checked_sub(1)?) + move_to_line(layout, self, h_pos, self.path.line_index.checked_add(1)?) } /// Given the layout that generated this cursor, return a new cursor @@ -175,7 +175,7 @@ impl Cursor { /// /// Returns `None` if the cursor should remain in its current position. pub fn prev_line(&self, layout: &Layout, h_pos: Option) -> Option { - move_to_line(layout, self, h_pos, self.path.line_index.checked_add(1)?) + move_to_line(layout, self, h_pos, self.path.line_index.checked_sub(1)?) } }