Fix Zed CLI column index broken on non-ASCII#47093
Closed
pigletfly wants to merge 3 commits intozed-industries:mainfrom
Closed
Fix Zed CLI column index broken on non-ASCII#47093pigletfly wants to merge 3 commits intozed-industries:mainfrom
pigletfly wants to merge 3 commits intozed-industries:mainfrom
Conversation
1114f63 to
adc22a3
Compare
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
adc22a3 to
38c3c2f
Compare
Contributor
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Thank you, looks nice overall and great that many places were changed to the new approach.
One extra place that needs a similar change is
zed/crates/go_to_line/src/go_to_line.rs
Line 210 in e8cfd19
Contributor
SomeoneToIgnore
added a commit
that referenced
this pull request
Mar 16, 2026
Closes #43329 ## Summary This fixes `path:line:column` navigation 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: - file finder navigation - recent project remote connection navigation - recent project remote server navigation It also adds regression coverage for the Unicode case that originally failed. As a small - necessary - prerequisite, this also adds `remote_connection` test support to `file_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_projects` - `cargo test -p file_finder --lib --no-run` - `cargo test -p file_finder file_finder_tests::test_row_column_numbers_query_inside_file -- --exact` - `cargo test -p file_finder file_finder_tests::test_row_column_numbers_query_inside_unicode_file -- --exact` - `cargo test -p text tests::test_point_for_row_and_column_from_external_source -- --exact` ## Manual I reproduced locally on my machine (macOS) w/ a stateless launch using a Unicode file (Cyrillic) Before: - `:1:5` landed too far left - `:1:10` landed around the 4th visible Cyrillic character After: - `:1:5` lands after 4 visible characters / before the 5th - `:1:10` lands after 9 visible characters / before the 10th Release Notes: - Fixed `path:line:column` navigation so non-ASCII columns land on the correct character. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #43329
before


after
Release Notes: