Fix file path detection across wrapped lines#9356
Fix file path detection across wrapped lines#9356Obed0101 wants to merge 1 commit intowarpdotdev:masterfrom
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @Obed0101 on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
I'm starting a first review of this pull request. You can follow along in the session on Warp. I approved this pull request and requested human review from: @vorporeal, @alokedesai, @zachbai. Comment I approved this pull request. No matching stakeholder was found for the changed files, so no human reviewers were requested. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR fixes terminal file path detection across soft-wrapped lines by merging adjacent path fragments only when neither side contains a file-link separator, and adds a regression test for hovering on both sides of the wrap boundary.
Concerns
- No blocking correctness, security, error-handling, or performance concerns found in the changed lines.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
There was a problem hiding this comment.
Overview
This PR fixes file path candidate generation across soft-wrapped terminal rows by concatenating adjacent wrapped fragments only when neither side contains a file-link separator. It also adds a regression test covering hover detection on both sides of the wrap boundary.
Concerns
- No blocking correctness or security concerns found in the changed lines.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
Thanks for the PR! @kevinyang372 could you take a look? |
|
Hi @Obed0101 I am not able to repro the original issue. I also confirmed the regression test you added is in fact passing on current master too. I don't think the bug is in the grid handler code and it might be platform related. Are you able to repro this? |
|
Thanks for checking. You're right — if the regression test passes on current master, it doesn't prove the issue. I based the patch on the soft-wrap fragment merge logic and the contradictory comment there, but I agree we shouldn't merge this unless it reproduces the reported behavior or has a failing regression on master. I'll take another pass to reproduce the original issue and trace whether the bug is actually in link validation/platform behavior instead of |
|
That sounds good. Thanks @Obed0101! |
fb6b469 to
6471374
Compare
|
I was able to reproduce the issue in the local app with a narrow terminal. The failure mode I saw was that Cmd-click sometimes resolved a valid prefix directory, for example I updated the patch to handle paths spanning more than two soft-wrapped rows. The previous regression only covered a two-row wrap, which is why it did not prove the bug. The new regression covers a file path split across four wrapped rows and verifies that the full path candidate/range is produced from hover points on each wrapped row. Validation: cargo test -p warp terminal::model::grid::grid_handler::tests::test_possible_file_paths_across_multiple_wrapped_lines --no-default-features
cargo test -p warp terminal::model::grid::grid_handler::tests::test_possible_file_paths --no-default-features
cargo build --bin warp-oss --features gui,skip_loginI also verified manually in the local app that the narrow wrapped path now opens the full |
kevinyang372
left a comment
There was a problem hiding this comment.
Nice find! This is definitely something we should fix
My high-level feedback here is this change is trying to do too many things:
- [Not controversial] For a link within max scan length, highlighting stops working when we have >2 softwrapped rows
- [More controversial] Also including some changes to bump overall scan length, this will have significant performance implications since now we are doing a lot more scanning when user moves their mouse
Let's focus on 1) and make sure we are scanning forward and backward in the grid until we fully fill up the max scan length limit.
Also I think the logic could be simplified a bit. Essentially what we want is:
- Iterate backwards until we either 1) hit a hard-wrapped line 2) fill up max scan limit. Push line range content into fragments
- Iterate forwards until we either 1) hit a hard-wrapped line 2) fill up max scan limit. Push line range content into fragments (some of the logic could definitely be shared with above)
6471374 to
3ce3596
Compare
|
Thanks, agreed. I narrowed the patch to preserve the existing file-link scan budget instead of increasing it. The updated version still scans across multiple soft-wrapped rows, but only until the existing I also adjusted the regression coverage so it verifies the multi-row behavior within the existing scan limit. Validation: cargo test -p warp terminal::model::grid::grid_handler::tests::test_possible_file_paths --no-default-features |
Description
Fixes #9193.
This updates terminal file path detection so fragments split only by a soft-wrapped terminal line are treated as one continuous path. Fragments are still kept separate when either side contains a file-link separator.
A regression test covers the long wrapped path from the issue and verifies detection from both sides of the wrap boundary.
Testing
cargo fmt --checkcargo test -p warp terminal::model::grid::grid_handler::tests::test_possible_file_paths_across_wrapped_lines --no-default-featuresServer API dependencies
None.
Changelog Entries for Stable
CHANGELOG-BUG-FIX: Fixed long file paths split across wrapped terminal lines not being detected as file links.