codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

feat(editor): wrap selection on code-character keypress #41

Merged
pat-s merged 6 commits from t3code/6477a22e into v15.0/forgejo-codefloe 2026-06-29 07:18:27 +00:00
Owner

Adds auto-surround ("enclosure") support to the markdown comment editor in textarea mode.

When text is selected and a code/markdown character is pressed, the selection is wrapped in that character instead of being replaced by it.
For example, selecting text and pressing the backtick key produces text.

Supported characters: backtick, asterisk, underscore, tilde, double quote, single quote, and the bracket pairs (), [], {}, <>.

Behavior:

  • Wrapping triggers only when there is a non-empty selection; with an empty selection the key types normally.
  • After wrapping, the inner text stays selected, so wrappers can be stacked.
  • Wrapping is a single undo step.
  • Triggers only when no Ctrl/Alt/Meta modifier is held (Shift is allowed, since several characters require it).
  • No toggle/unwrap; pressing a wrapper on already-wrapped text simply nests another pair.

Scope is limited to the markdown comment editor textarea mode.
EasyMDE and the CodeMirror 6 file editor are untouched (CodeMirror already auto-surrounds bracket selections via its closeBrackets extension).

Adds auto-surround ("enclosure") support to the markdown comment editor in textarea mode. When text is selected and a code/markdown character is pressed, the selection is wrapped in that character instead of being replaced by it. For example, selecting `text` and pressing the backtick key produces ```text```. Supported characters: backtick, asterisk, underscore, tilde, double quote, single quote, and the bracket pairs `()`, `[]`, `{}`, `<>`. Behavior: - Wrapping triggers only when there is a non-empty selection; with an empty selection the key types normally. - After wrapping, the inner text stays selected, so wrappers can be stacked. - Wrapping is a single undo step. - Triggers only when no Ctrl/Alt/Meta modifier is held (Shift is allowed, since several characters require it). - No toggle/unwrap; pressing a wrapper on already-wrapped text simply nests another pair. Scope is limited to the markdown comment editor textarea mode. EasyMDE and the CodeMirror 6 file editor are untouched (CodeMirror already auto-surrounds bracket selections via its closeBrackets extension).
Design for wrapping a non-empty selection in the markdown comment editor
when a code/markdown character (backtick, asterisk, brackets, etc.) is pressed.
feat(editor): wrap selection on code-character keypress
Some checks failed
testing / frontend-checks (pull_request) Failing after 1m8s
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
testing / backend-checks (pull_request) Has been cancelled
c137686b54
fix(lint): avoid destructuring in wrapTextareaSelection
Some checks failed
testing / frontend-checks (pull_request) Successful in 2m1s
testing / backend-checks (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
731f31775d
The unicorn/consistent-destructuring rule flagged mixing destructured
selectionStart/selectionEnd with direct textarea.value/selectionEnd access.
Use direct property reads throughout, matching the sibling replaceTextareaSelection.
chore: untrack docs/superpowers and gitignore it
All checks were successful
testing / test-mysql (pull_request) Successful in 31m38s
testing / frontend-checks (pull_request) Successful in 1m49s
testing / backend-checks (pull_request) Successful in 14m26s
testing / test-unit (pull_request) Successful in 18m37s
testing / test-sqlite (pull_request) Successful in 38m47s
testing / test-remote-cacher (valkey) (pull_request) Successful in 4m23s
testing / test-remote-cacher (redis) (pull_request) Successful in 4m25s
testing / test-remote-cacher (garnet) (pull_request) Successful in 4m24s
testing / test-e2e (pull_request) Successful in 31m19s
testing / test-pgsql (pull_request) Successful in 43m52s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
3cfecd1a56
These spec/plan artifacts are local workflow scratch, not part of the
project, and should not live in the repository.
pat-s merged commit e8c463b040 into v15.0/forgejo-codefloe 2026-06-29 07:18:27 +00:00
pat-s deleted branch t3code/6477a22e 2026-06-29 07:18:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!41
No description provided.