Fix Buffer::goto_first_whitespace
This commit is contained in:
parent
9558cdadb4
commit
74e1bd88c6
|
@ -274,11 +274,12 @@ impl Buffer {
|
||||||
pub fn cursor_at_first_nonwhitespace(&self, line: usize) -> Cursor {
|
pub fn cursor_at_first_nonwhitespace(&self, line: usize) -> Cursor {
|
||||||
if let Some(line_slice) = self.text.get_line(line) {
|
if let Some(line_slice) = self.text.get_line(line) {
|
||||||
let mut column = 0;
|
let mut column = 0;
|
||||||
for c in line_slice.chars().reversed() {
|
for c in line_slice.chars() {
|
||||||
column += 1;
|
|
||||||
if !c.is_whitespace() {
|
if !c.is_whitespace() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
column += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor { line, column }
|
Cursor { line, column }
|
||||||
|
|
Loading…
Reference in New Issue