Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions app/src/terminal/model/grid/grid_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ impl GridHandler {
// Note that if any one of the two fragments has separator, we shouldn't
// concatenate them.
(Some(prev_line_fragment), Some(current_line_fragment))
if prev_line_fragment.has_separator()
|| current_line_fragment.has_separator() =>
if !prev_line_fragment.has_separator()
&& !current_line_fragment.has_separator() =>
{
let mut fragment =
prev_line_fragments.pop().expect("Fragment should exist");
Expand Down Expand Up @@ -1175,8 +1175,8 @@ impl GridHandler {

match (current_line_fragments.last(), next_line_fragments.first()) {
(Some(current_line_fragment), Some(next_line_fragment))
if current_line_fragment.has_separator()
|| next_line_fragment.has_separator() =>
if !current_line_fragment.has_separator()
&& !next_line_fragment.has_separator() =>
{
let mut fragment =
current_line_fragments.pop().expect("Fragment should exist");
Expand Down
33 changes: 33 additions & 0 deletions app/src/terminal/model/grid/grid_handler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,39 @@ fn test_possible_file_paths() {
);
}

#[test]
fn test_possible_file_paths_across_wrapped_lines() {
let first_line = "src/modules/core/internal/utils/wrappers/adapters/";
let second_line = "interfaces/implementations/factories/README.md";
let full_path = format!("{first_line}{second_line}");
let expected_range = Point { row: 0, col: 0 }..=Point {
row: 1,
col: second_line.len() - 1,
};
let blockgrid = mock_blockgrid(&format!("{first_line}\n{second_line}"));

for hover_point in [
Point {
row: 0,
col: first_line.len() - 2,
},
Point { row: 1, col: 5 },
] {
let possible_paths = blockgrid
.grid_handler
.possible_file_paths_at_point(hover_point);

assert!(
possible_paths.iter().any(|possible_path| {
possible_path.path.path.as_str() == full_path.as_str()
&& possible_path.path.line_and_column_num.is_none()
&& possible_path.range == expected_range
}),
"expected wrapped file path candidate at {hover_point:?} in {possible_paths:?}"
);
}
}

#[test]
fn test_fragment_boundary_at_point() {
let assert_fragment_boundary =
Expand Down
Loading