linebender / linebender/parley

Text editing behavior in BiDi is different between LeftArrow and Ctrl+LeftArrow

Open
#118 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The easiest way to describe the problem is to show this snippet from the vello_editor example:

KeyCode::ArrowLeft => {
    self.selection = if ctrl {
        self.selection.previous_word(&self.layout, shift)
    } else {
        self.selection.previous_visual(
            &self.layout,
            self.cursor_mode,
            shift,
        )
    };
}

By default, pressing an arrow key moves your cursor in the visual direction of your key. But if you're doing ctrl+arrow, now the editor switches to "left means upstream, right means downstream". Both behaviors are mostly fine on their own (though "left means upstream" is latin-centric), but they're inconsistent with each other.

This behavior doesn't match either Chrome or Firefox.

(Parley's behavior with Home and End is also different from both Chrome and Firefox, but there's less of an inconsistency there, and Home/End support in BiDi is bad in both Chrome and Firefox anyway.)

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 examples/vello_editor/src/text.rs, especially lines 168-178, and trace the previous_visual and previous_word entry points used for LeftArrow and Ctrl+LeftArrow. Compare their BiDi behavior with Chrome and Firefox. Done means arrow-key and Ctrl+arrow-key movement follow a consistent visual-direction model in BiDi text.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
internationalization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.