forked from mars/breed
Merge branch 'main' into append
This commit is contained in:
commit
31adade996
|
@ -47,6 +47,11 @@ impl Buffer {
|
|||
out.execute(cursor::MoveTo(0, 0))?;
|
||||
|
||||
for (row, line) in (0..rows).zip(self.text.lines_at(scroll.line)) {
|
||||
// only the last line is empty and should be skipped
|
||||
if line.len_chars() == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
let row = row as usize + scroll.line;
|
||||
write!(out, "{:width$} ", row, width = lr_width as usize)?;
|
||||
|
||||
|
@ -91,7 +96,7 @@ impl Buffer {
|
|||
}
|
||||
}
|
||||
Direction::Down => {
|
||||
if cursor.line < self.text.len_lines() {
|
||||
if cursor.line + 2 < self.text.len_lines() {
|
||||
cursor.line += 1;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +108,7 @@ impl Buffer {
|
|||
Direction::Right => {
|
||||
let line = self.text.line(cursor.line);
|
||||
if cursor.column + 2 > line.len_chars() {
|
||||
if enable_linewrap && cursor.line < self.text.len_lines() {
|
||||
if enable_linewrap && cursor.line + 2 < self.text.len_lines() {
|
||||
cursor.line += 1;
|
||||
cursor.column = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue