Skip to content

Fix Zed CLI column index broken on non-ASCII#47093

Closed
pigletfly wants to merge 3 commits intozed-industries:mainfrom
pigletfly:fix-zed-cli
Closed

Fix Zed CLI column index broken on non-ASCII#47093
pigletfly wants to merge 3 commits intozed-industries:mainfrom
pigletfly:fix-zed-cli

Conversation

@pigletfly
Copy link
Copy Markdown
Contributor

@pigletfly pigletfly commented Jan 18, 2026

Closes #43329

before
image
after
image

Release Notes:

  • Fix Zed CLI column index broken on non-ASCII

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 18, 2026
@maxdeviant maxdeviant changed the title Fix zed cli column index broken on non ascii Fix Zed CLI column index broken on non-ASCII Jan 18, 2026
@SomeoneToIgnore SomeoneToIgnore self-assigned this Feb 4, 2026
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

fn anchor_from_query(
(it needs some modification though, but the problem here is the same multi-char UTF-8 approach).

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

image

Will close as stale for now, but it looks like 60% of the job is done and the PR was on the right track.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zed cli column index broken on non ascii

3 participants