cursor: break line after \n

Up to now, the cursor broke the line *before* the
\n and made that character the 0th one in the new
line.  I don't know why i did this, but at least
it's fixed now.
main
anna 2 years ago
parent 7b715a2cfb
commit a8130c864d
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -18,7 +18,7 @@ impl Iterator for Cursor {
let c = self.raw[self.pos];
self.pos += 1;
if c == '\n' {
if self.current == Some('\n') {
self.new_line();
} else {
self.col += 1;
@ -51,10 +51,9 @@ impl Cursor {
self.pos -= 1;
let c = self.raw[self.pos];
self.col -= 1;
if self.col == 0 {
self.prev_line();
} else {
self.col -= 1;
}
self.current = Some(c);
@ -132,7 +131,7 @@ impl Cursor {
fn new_line(&mut self) {
self.line_lengths.push(self.col);
self.col = 0;
self.col = 1;
self.line += 1;
}

Loading…
Cancel
Save