Skip to content

Commit

Permalink
Fix go-to-line test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Sep 27, 2024
1 parent 9162806 commit 1845205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11644,7 +11644,9 @@ impl Editor {
let start = highlight.range.start.to_display_point(&snapshot);
let end = highlight.range.end.to_display_point(&snapshot);
let start_row = start.row().0;
let end_row = if end.column() == 0 {
let end_row = if highlight.range.end.text_anchor != text::Anchor::MAX
&& end.column() == 0
{
end.row().0.saturating_sub(1)
} else {
end.row().0
Expand Down
16 changes: 8 additions & 8 deletions crates/go_to_line/src/go_to_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl GoToLine {
self.active_editor.update(cx, |active_editor, cx| {
let snapshot = active_editor.snapshot(cx).display_snapshot;
let start = snapshot.buffer_snapshot.clip_point(point, Bias::Left);
let end = point + Point::new(1, 0);
let end = start + Point::new(1, 0);
let start = snapshot.buffer_snapshot.anchor_before(start);
let end = snapshot.buffer_snapshot.anchor_after(end);
active_editor.clear_row_highlights::<GoToLineRowHighlights>();
Expand Down Expand Up @@ -246,13 +246,13 @@ mod tests {
field_1: i32, // display line 3
field_2: i32, // display line 4
} // display line 5
// display line 7
struct Another { // display line 8
field_1: i32, // display line 9
field_2: i32, // display line 10
field_3: i32, // display line 11
field_4: i32, // display line 12
} // display line 13
// display line 6
struct Another { // display line 7
field_1: i32, // display line 8
field_2: i32, // display line 9
field_3: i32, // display line 10
field_4: i32, // display line 11
} // display line 12
"}
}),
)
Expand Down

0 comments on commit 1845205

Please sign in to comment.