Fix Buffer::goto_first_whitespace

This commit is contained in:
mars 2023-04-14 15:40:02 -04:00
parent 9558cdadb4
commit 74e1bd88c6
1 changed files with 3 additions and 2 deletions

View File

@ -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 }