Fix line number rendering.

pull/3/head
Blaž Hrastnik 4 years ago
parent 883b77bd24
commit 226fa89d46

@ -221,7 +221,7 @@ impl Editor {
let style: Style = view.theme.get("ui.linenr");
for (i, line) in (view.first_line..(last_line as u16)).enumerate() {
self.surface
.set_stringn(0, line, format!("{:>5}", i + 1), 5, style);
.set_stringn(0, i as u16, format!("{:>5}", line + 1), 5, style);
// lavender
}

@ -53,7 +53,7 @@ impl View {
#[inline]
pub fn last_line(&self, viewport: Rect) -> usize {
std::cmp::min(
(self.first_line + viewport.height - 1) as usize,
(self.first_line + viewport.height) as usize,
self.state.doc().len_lines() - 1,
)
}

Loading…
Cancel
Save