From 74e1bd88c6a8937fed8af9db736a3f3f2ac9dea0 Mon Sep 17 00:00:00 2001 From: mars Date: Fri, 14 Apr 2023 15:40:02 -0400 Subject: [PATCH] Fix Buffer::goto_first_whitespace --- src/buffer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index 7455214..ca86144 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -274,11 +274,12 @@ impl Buffer { pub fn cursor_at_first_nonwhitespace(&self, line: usize) -> Cursor { if let Some(line_slice) = self.text.get_line(line) { let mut column = 0; - for c in line_slice.chars().reversed() { - column += 1; + for c in line_slice.chars() { if !c.is_whitespace() { break; } + + column += 1; } Cursor { line, column }