Fix non-ASCII path:line:column navigation#51238
Fix non-ASCII path:line:column navigation#51238SomeoneToIgnore merged 8 commits intozed-industries:mainfrom
Conversation
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Any chance we can address the #47093 (review) comment?
I checked that old review comment again. This PR does add the missing failing regression coverage in file_finder for the Unicode path:line:column case. The red CI is/was a separate regression on the existing out-of-bounds behavior, which I’ve now fixed (I think) by switching these open path flows to anchor based nav so EOF still clips correctly. |
|
I walked through the CI failures and pushed a follow-up fix. Changes in the update: That preserves the Unicode column fix from this PR and fixes the separate out-of-bounds regression that CI caught. I'm still fairly new to the codebase, so if I missed anything or took the wrong approach, I’d appreciate the correction. Thanks! |
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Great, thank you for covering all places.
A few minor things left to fix and we're ready to merge.
|
Thanks @SomeoneToIgnore. These were all good calls and exactly the kind of thing I need this early into the codebase. I will eliminate the waste as I get more familiar - thank you. So, I tightened the impl and pushed the follow up... • restored the external nav call sites to I also reran the stateless zed /path/to/unicode.txt:1:1/5/10/999 launch path locally after the final fix and it's good. If I've made errors or introduced waste/inefficiencies that you see - point them out and I'll circle back. Thanks a lot! Note Obviously, the PR body is a bit stale. If you need it updated... let me know, but I imagine we're both on the same page - yes? Edit Rebased onto current main and fixed a manifest conflict that surfaced |
72680ef to
67acad0
Compare
|
You're welcome! I noticed that the 'Tidy Up' commit looks to have broken the way the cursor mapping works, though? I think we need to restore inclusive endpoint handling in buffer_point_to_anchor, yeah? The expected clamping behavior is defined in the test such that if the row/column are out of file bounds, they should clamp to last valid position (last row/last column). Isn't that the desired behavior here? |
|
Thanks for noticing the culprit of the test failure: I have not found that particular change clear hence tried to revert. I'm trying to think of other way to fix this all now. |
|
Tips Hat Thanks for working with me, @SomeoneToIgnore. It's been a pleasure. After seeing the update, I understand. Thanks again! |


Closes #43329
Summary
This fixes
path:line:columnnavigation for files containing non-ASCII text.Before this change, open path flows were passing the external column directly into
go_to_singleton_buffer_point. That happened to work for ASCII, but it was wrong for Unicode because external columns are user-visible character positions while the editor buffer stores columns as UTF-8 byte offsets.This PR adds a shared text layer conversion for external row/column coordinates and uses it in the affected open-path flows:
It also adds regression coverage for the Unicode case that originally failed.
As a small - necessary - prerequisite, this also adds
remote_connectiontest support tofile_finder's dev-deps so the local regression test can build and run on this branch. That follows the same feature mismatch pattern previously fixed in #48280. I wasn't able to locally verify the tests/etc. w/o the addition... so I've rolled it into this PR. Tests are green.The earlier attempt in #47093 was headed in the right direction, but it did not land and did not include the final regression coverage requested in review.
Verification
cargo fmt --all -- --check./script/clippy -p text./script/clippy -p file_finder./script/clippy -p recent_projectscargo test -p file_finder --lib --no-runcargo test -p file_finder file_finder_tests::test_row_column_numbers_query_inside_file -- --exactcargo test -p file_finder file_finder_tests::test_row_column_numbers_query_inside_unicode_file -- --exactcargo test -p text tests::test_point_for_row_and_column_from_external_source -- --exactManual
I reproduced locally on my machine (macOS) w/ a stateless launch using a Unicode file (Cyrillic)
Before:
:1:5landed too far left:1:10landed around the 4th visible Cyrillic characterAfter:
:1:5lands after 4 visible characters / before the 5th:1:10lands after 9 visible characters / before the 10thRelease Notes:
path:line:columnnavigation so non-ASCII columns land on the correct character.