emma
/
breed
Archived
forked from mars/breed
1
0
Fork 0

Merge branch 'main' into append

This commit is contained in:
mars 2023-04-11 21:48:21 +00:00
commit 31adade996
1 changed files with 7 additions and 2 deletions

View File

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