linebender / linebender/parley

Cursor motion steps are codepoints, not grapheme clusters

Open
#694 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
736
Forks
120
Avg merge
1d 3h
Merged PRs (30d)
53

Description

Similar to the deletion (backspace/delete) in https://github.com/linebender/parley/pull/693 but a bit more complex to fix.

This affects at least move_left/move_right but likely also others like shift selection, clicking to select a cursor position,...

When moving the cursor it ends up in the middle of graphemes, taking as many steps to step through as it has codepoints to get to the other side.

The reason this is harder to fix is that the LayoutContext is not available from Cursor::next_visual and similar places, just &Layout so we can't easily reach the ICU grapheme segmenter. Since that would be a bigger API change I did not make a PR for this but just an issue. The shaper already computes grapheme cluster boundaries so this is more a question of the desired API shape.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cursor::next_visual and the move_left/move_right paths, then inspect how the shaper computes grapheme cluster boundaries. Consider how LayoutContext, &Layout, and the ICU grapheme segmenter could be connected without losing the existing API shape. Done means cursor movement and related selection or positioning operations step across grapheme clusters rather than codepoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.