Repository navigation
Description
Context — In a Note's editor (the formatted text), a double click only places the caret: the word under the pointer is not selected, where every text field and the code editor of a snippet select it. Reported on 1.2.1.
Change — In a Note, a double click selects the word under the pointer (highlighted, ready to be typed over, formatted or copied) and a triple click selects the paragraph, as in the code editor.
To do
- Double click: select the word around the clicked position within its leaf (paragraph, heading, list item, table cell, code block).
- Triple click: select the whole leaf.
- One definition of a word, shared with the code editor (letters, digits and
_; a run of punctuation is its own word; a space selects the spaces around it). - Shift + double click extends the selection to the end of that word.
Tests — Unit in text (the shared word rule): the boundaries of déjà-vu, foo_bar, a.b, spaces, emoji. kittest in rich/tests.rs: a double click on world in « hello world » selects world (selection range and highlight); a triple click selects the paragraph. e2e 03_editing_a_note: a step double-clicks a word of a Note, types over it and reads the body.
Technical analysis
Cause. The rich editor's pointer handler, ui/src/notes/overlays/editor/rich.rs:514 pointer, knows three gestures: press or click places the head (move_head, Shift extends), drag extends. It never reads double_clicked() or triple_clicked(), so the second click of a double click only places the caret again. The code editor's handler, ui/src/widgets/editor/input.rs:21, does both: double_clicked → buffer.step(at, Backward, Unit::Word) then Forward; triple_clicked → the line.
Fix. In pointer, test surface.triple_clicked() then surface.double_clicked() before the press branch (egui reports the press too, so the order matters, as in input.rs). For the word, the rule lives today in text::buffer::Buffer::word (crates/text/src/buffer.rs:509, classes space / punctuation / word over a rope). Extract it as a pure function over a &str, e.g. text::words::word_around(text, offset) -> Range<usize> (chars), have Buffer::word use it, and call it from the rich editor on the leaf's plain text (richtext::tree::leaf → inlines::plain), whose char offsets are the Position.offset the selection uses. One rule, one definition (D10). Selecting the leaf for a triple click is Selection { anchor: (path, 0), head: (path, len) }.
Risk. Low. Interaction with links: a Ctrl+click follows a link, a plain double click on a link's text selects it (no navigation, as today). Check images and task boxes keep their own click (they are other responses).
Activity
vmillet-dev commentedon Nov 27, 2026
Fixed by #1681, merged into
dev/1.2.2.