Add a Ctrl+/ whole-line comment toggle to the editor

The app already treats `<!-- ... -->` as editorial notes: preprocess
strips them from the export and the word count. Ctrl+/ makes that a
one-key move, so a paragraph can be shelved without being deleted.

It grows the selection out to line boundaries first, and only toggles a
block back off when every non-blank line in it is already commented.
Blank lines are passed through so paragraph breaks survive the round
trip, and pressing it on an empty line opens `<!--  -->` with the caret
inside.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GBWj9TphFMCoh7VHaSRnvQ
This commit is contained in:
landon
2026-09-07 11:03:02 -05:00
parent a23cd5abfe
commit 70046b0382
3 changed files with 213 additions and 3 deletions
+9
View File
@@ -97,6 +97,15 @@ Terminal=false
| `Ctrl/Cmd + E` | `inline code` |
| `Ctrl/Cmd + Shift + X` | ~~strikethrough~~ (`~~…~~`) |
| `Ctrl/Cmd + K` | link — `[selection](url)`, with `url` selected to replace |
| `Ctrl/Cmd + /` | comment the selected lines out (`<!-- … -->`), or take it back off |
`Ctrl/Cmd + /` is the odd one out: it works on whole lines, growing the
range out to line boundaries first, and it toggles the block off again
only when every non-blank line in it is already commented. Commented lines
stay in the file but drop out of the export and the word count, so this is
the way to shelve a paragraph without losing it. Blank lines in the range
are left as-is so paragraph breaks survive; pressing it on an empty line
opens `<!-- -->` with the caret inside.
Press **`Ctrl/Cmd + F`** (or **Edit ▸ Find / Replace…**) to open the
find/replace bar above the editor; **`Ctrl/Cmd + H`** opens it with the