Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #56748 ## Summary Block / column selection (Shift+Ctrl+drag on Linux, Shift+Cmd+drag on macOS) anchored its rectangle on a single byte column applied to every row in the dragged range. On a row whose text contained a multi-byte character before that column (for example `ã`), the same byte offset mapped to a different visual `x`, so the per-row cursor drifted off the column. `select_columns` now anchors the rectangle in `x` pixels via `x_for_display_point` and resolves each row's byte column with `display_column_for_x` — the same pair of helpers already used by vertical cursor motion and Vim VisualBlock. ## Before / After **Before** — cursor on the `ã` row drifts one column to the left: <img width="1068" height="366" alt="image" src="https://github.com/user-attachments/assets/0559ef89-852e-40f3-9d43-f5f44277f99e" /> **After** — rectangle stays visually aligned across rows: <img width="866" height="408" alt="image" src="https://github.com/user-attachments/assets/bce13c1a-1ddb-4fd6-8216-2c0e902f6668" /> ## Test plan - `cargo test -p editor test_columnar_selection_with_multibyte_chars` (new regression test covers the buggy case past the `ã` byte boundary, plus a control case where old and new logic agree). - Manual: Shift+Ctrl+drag down a five-line buffer where row 3 contains `ã` — selection rectangle stays aligned (see screenshots). - Manual: Shift+Alt+drag (`FromSelection` branch) over the same buffer — same result. - Manual: drag past EOL on the `ã` row — each row extends to its own EOL with no panic. Release Notes: - Fixed misalignment of column selection on rows that contain multi-byte characters --------- Co-authored-by: Tom Houlé <tom@tomhoule.com>
2 files changedLine totals unavailable