Skip to content

Note editor: wrapped lines lit when selected, copied lists keep markers - #1682

Merged
vmillet-dev merged 1 commit into
dev/1.2.2from
note-copy-markers
Nov 27, 2026
Merged

vmillet-dev merged 1 commit into
dev/1.2.2from
note-copy-markers

Conversation

@vmillet-dev

@vmillet-dev vmillet-dev commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #1674

Reproduced on dev/1.2.2:

  • selection_rects over a line wrapped on three rows, all selected: the second row's rectangle starts at x = 72, the end of the row above (unit test); in a Note, Ctrl+A over a long bullet item leaves its wrapped rows unlit (kittest, first capture).
  • Ctrl+A then copy over - one **bold**\n- two\n\n1. first\n2. second puts one bold\ntwo\nfirst\nsecond on the clipboard.

Change

  • Every selected row is lit, wrapped rows included: a row's start is read on that row (prefer_next_row), in Notes, in the code editor's wrap mode and for the find bar's matches, which share the function.
  • Ctrl+C, Cut and the menu copy the selection as text that keeps its blocks: - before a bullet item, its own number before a numbered one, - [ ] / - [x] before a task, > in a quote, two spaces a level of nesting; bold, italic, code and links come out as their text. A selection within one paragraph copies its text alone.
  • Copy as Markdown (Ctrl+Shift+C, shown in the keys sheet, and the editor's new right-click menu: Cut, Copy, Copy as Markdown, Paste, Select all) copies the selection as the Markdown the Note is stored in, marks included.
  • Both are one fragment of the document (richtext::edit::fragment, the first and last leaves cut at the selection's ends), walked for the text or written by richtext::write. Search's replace and the link dialog keep selected_text.
  • The right-click menu is drawn as the application's other menus (menu_frame, fitted_menu), at the pointer.
Before After
—

Tests

  • widgets/editor/tests.rs: a line wrapped on three rows, all selected, gives one rectangle a row, each from its own start. Fails on dev/1.2.2.
  • notes/overlays/editor/rich/tests.rs: Ctrl+A over a wrapped item lights each of its rows (fails on dev/1.2.2); a copied list keeps its markers and drops the marks (fails on dev/1.2.2); Ctrl+Shift+C and the menu copy the Markdown, the menu's Copy the text.
  • richtext/src/edit/tests.rs: bullets, a numbered list from 3, tasks, a nested list, a quote, a heading and marks; a selection cut inside items keeps their numbers, one inside an item gives its text alone; « Copy as Markdown » reads back to the same blocks.
  • e2e 03_editing_a_note: a Note with a long bullet item, Ctrl+A, copy, the clipboard holds - …\n- court (new driver calls copy and clipboard_holds). Run on a hidden desktop after the rebase onto Note editor: a double click selects the word, a triple the paragraph #1681: passed (a first run there had the clipboard refused to the window, arboard: « Could not place the specified text »).
  • captures.rs: a wrapped list selected, then the right-click menu.
  • Run: fmt, clippy (workspace, all targets, all features), cargo test -p ui --lib (997 passed), cargo test -p richtext, prettier on the JSON.

🤖 Generated with Claude Code

@vmillet-dev vmillet-dev added the bug Something isn't working label Nov 27, 2026
A row's start is read on that row. Ctrl+C copies the selection with its blocks' markers; Copy as Markdown (Ctrl+Shift+C, the new right-click menu) writes it as the Note's Markdown.
@vmillet-dev
vmillet-dev merged commit b36ebe8 into dev/1.2.2 Nov 27, 2026
28 of 34 checks passed
@vmillet-dev
vmillet-dev deleted the note-copy-markers branch November 27, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant