Skip to content

Fix moving to next word boundary with multi-byte characters#123

Merged
nathansobo merged 1 commit intomainfrom
fix-word-boundary-movement-multibyte
Aug 5, 2021
Merged

Fix moving to next word boundary with multi-byte characters#123
nathansobo merged 1 commit intomainfrom
fix-word-boundary-movement-multibyte

Conversation

@as-cii
Copy link
Member

@as-cii as-cii commented Aug 2, 2021

Previously, for a given point, we would create a char iterator at the start of the row and then skip column characters. This is
however incorrect because display points are expressed in bytes, and so we could park the anchor midway through a multi-byte character.

This commit fixes the issue by switching DisplayMap::chars_at to take a point instead and skipping characters correctly when a point with a non-zero column is provided.

/cc: @nathansobo @maxbrunsfeld

Previously, for a given point, we would create a char iterator at
the start of the row and the skip `column` characters. This is
however incorrect because display points are expressed in bytes,
and so we could park the anchor midway through a multi-byte character.

This commit fixes the issue by switching `DisplayMap::chars_at` to
take a point instead and skipping characters correctly when a point with
a non-zero column is provided.
@nathansobo
Copy link
Contributor

Thanks for fixing this ⚡.

@nathansobo nathansobo merged commit d9ab406 into main Aug 5, 2021
@nathansobo nathansobo deleted the fix-word-boundary-movement-multibyte branch August 5, 2021 14:59
br-schneider added a commit to br-schneider/zed that referenced this pull request Feb 6, 2026
HTML character references (e.g., `·`, `'`, `&zed-industries#123;`) are parsed
by tree-sitter but not captured by any highlight query, so they render as
unhighlighted plain text.

This adds highlight captures for:
- `html_character_reference` in TSX and JavaScript (JSX context)
- `entity` in HTML

All three are captured as `@string.special`, which is already styled by
the built-in themes.
br-schneider added a commit to br-schneider/zed that referenced this pull request Feb 22, 2026
HTML character references (e.g., `·`, `'`, `&zed-industries#123;`) are parsed
by tree-sitter but not captured by any highlight query, so they render as
unhighlighted plain text.

This adds highlight captures for:
- `html_character_reference` in TSX and JavaScript (JSX context)
- `entity` in HTML

All three are captured as `@string.special`, which is already styled by
the built-in themes.
yeskunall pushed a commit that referenced this pull request Feb 23, 2026
)

HTML character references like `·`, `'`, and `{` are
correctly parsed by tree-sitter as named nodes
(`html_character_reference` in TSX/JavaScript, `entity` in HTML), but no
highlight query captures them. This means they render as plain,
unhighlighted text in the editor.

This PR adds one-line highlight captures for each:

- **TSX** (`crates/languages/src/tsx/highlights.scm`):
`(html_character_reference) @string.special`
- **JavaScript** (`crates/languages/src/javascript/highlights.scm`):
`(html_character_reference) @string.special`
- **HTML** (`extensions/html/languages/html/highlights.scm`): `(entity)
@string.special`

`@string.special` is already styled by all built-in themes (One Dark,
Ayu, Gruvbox, etc.), so no theme changes are needed.

Release Notes:

- Added syntax highlighting for HTML character references (`·`,
`'`, `{`, etc.) in TSX, JavaScript, and HTML files.
Anthony-Eid pushed a commit to bobbymannino/zed that referenced this pull request Feb 25, 2026
…-industries#48629)

HTML character references like `·`, `'`, and `&zed-industries#123;` are
correctly parsed by tree-sitter as named nodes
(`html_character_reference` in TSX/JavaScript, `entity` in HTML), but no
highlight query captures them. This means they render as plain,
unhighlighted text in the editor.

This PR adds one-line highlight captures for each:

- **TSX** (`crates/languages/src/tsx/highlights.scm`):
`(html_character_reference) @string.special`
- **JavaScript** (`crates/languages/src/javascript/highlights.scm`):
`(html_character_reference) @string.special`
- **HTML** (`extensions/html/languages/html/highlights.scm`): `(entity)
@string.special`

`@string.special` is already styled by all built-in themes (One Dark,
Ayu, Gruvbox, etc.), so no theme changes are needed.

Release Notes:

- Added syntax highlighting for HTML character references (`·`,
`'`, `&zed-industries#123;`, etc.) in TSX, JavaScript, and HTML files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants