Skip to content

Release v0.1.2: line keys and paste in code blocks - #112

Merged
ttncode merged 2 commits into
mainfrom
fix/code-block-line-keys
Nov 30, 2026
Merged

ttncode merged 2 commits into
mainfrom
fix/code-block-line-keys

Conversation

@ttncode

@ttncode ttncode commented Nov 30, 2026

Copy link
Copy Markdown
Owner

What

Code block fixes, released as v0.1.2.

  • In a code block, Ctrl+L selected the whole block. It now selects the caret's line, and each next press adds a line.
  • Pasting copied code into a code block nested a second <pre>, which showed as a small box inside the block. Paste into code now inserts plain text.
  • The other line keys had the same problem in code blocks: copy and cut with nothing selected, move, duplicate and indent line. They now act on the caret's code line. Ctrl+Enter adds an empty code line instead of a body line that split the block.

Why

A code block keeps its lines inside one <pre>, split by <br> or \n, and the line keys treat each <pre> as one line. Before a line key runs, splitCodeLines now splits the <pre> under the selection into one <pre> per line, the run of <pre> that a code block already is. The selection is put back on the same text.

Checks

  • node --test tests/*.test.js: 247 pass, including new tests for splitCodeLines, pointInCodeLines and insertLine in code.
  • Checked in Chrome on a mounted NoteEditor: Ctrl+L twice, copy and paste in code, duplicate, insert, indent, move and cut.
  • Not run: the e2e suite (needs the built app). Not checked: dragging code into a code block.

After merge: tag v0.1.2 and follow RELEASING.md from step 4.

@ttncode
ttncode merged commit 50b71cb into main Nov 30, 2026
1 check passed
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