Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion xray_core/src/buffer_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ impl View for BufferView {
}

let longest_row = buffer.longest_row();
let longest_line = if start.row <= longest_row && longest_row <= end.row {
let longest_line = if start.row <= longest_row && longest_row < end.row {
lines[(longest_row - start.row) as usize].clone()
} else {
String::from_utf16_lossy(&buffer.line(buffer.longest_row()).unwrap())
Expand Down Expand Up @@ -1903,6 +1903,23 @@ mod tests {
}
}

#[test]
fn test_longest_line_in_frame() {
let buffer = Rc::new(RefCell::new(Buffer::new(0)));
buffer
.borrow_mut()
.edit(&[0..0], "1\n1\n1\n1\n11\n1\n1");
let line_height = 6.0;

let mut editor = BufferView::new(buffer.clone(), 0, None);
editor
.set_height(2.0 * line_height)
.set_line_height(line_height)
.set_scroll_top(2.0 * line_height);

let _ = editor.render();
}

#[test]
fn test_render_past_last_line() {
let line_height = 4.0;
Expand Down