Skip to content

feat: #2994 add fixed indentation shortcuts and list body Tab input - #5906

Merged
Jocs merged 1 commit into
developfrom
feat/2994-indent-shortcuts
Oct 27, 2026
Merged

Jocs merged 1 commit into
developfrom
feat/2994-indent-shortcuts

Conversation

@Jocs

@Jocs Jocs commented Oct 27, 2026

Copy link
Copy Markdown
Member

Closes #2994

Summary

Tab at a caret inside list text previously moved the entire item, or did nothing in the first item. This PR separates body input from explicit indentation: Tab in list text inserts the existing configured input unit, while fixed bracket shortcuts adjust the current line or list level from any caret position.

  • Windows/Linux: Ctrl+] indents; Ctrl+[ outdents. macOS: Cmd+] / Cmd+[. These are fixed editor shortcuts; no custom shortcut commands or preference entries are added.
  • Paragraphs: adjust the current or selected lines, including a caret at column zero. Preserve the selection and use the existing CommonMark paragraph-to-code conversion when indentation reaches four columns.
  • Lists: the fixed shortcuts move the current or selected items structurally. Tab at an item start still indents the item; Tab with a collapsed caret inside its text inserts real U+0009 or the chosen spaces. Selected list items and existing Shift+Tab behavior remain structural.
  • Code: adjust whole current/selected lines, preserve single-line selections, and skip HTML completion. Code nested inside a list edits code whitespace rather than moving its list owner.
  • Each edit has its own undo step. Excluded selection endpoints stay valid across repeated list indent/outdent. Shift-modified heading folding, composition, table navigation, and unsupported mixed-block selections keep their existing behavior.

Implementation

The editor checks applicability separately from mutation and dispatches fixed shortcuts to the same editTab, list-movement, and paragraph-conversion operations used by Tab selections. Selection endpoints at an excluded item's start resolve against the preceding selected content, including after the endpoint has moved outside the selected list.

No document fields, parser/serializer changes, desktop shortcut configuration, or new settings are introduced. Source mode already has the matching CodeMirror bindings. The source-whitespace preservation work tracked by #2189 remains deferred.

Validation

  • Muya unit tests: 3,978 passed.
  • Desktop unit tests: 1,438 passed; 3 native ced tests skipped because this isolated worktree was installed without native build scripts, matching CI's documented skip condition.
  • CommonMark/GFM regression suites: 1,347 passed, including the existing expected-failure checks.
  • Chromium: 20 passed, including real Ctrl and Cmd bracket events, list-body Tab, item-start Tab, backward selection endpoints, code selection preservation, paragraph conversion, and undo.
  • Root/Muya ESLint, type checks, and circular-dependency checks passed. Existing lint warnings remain; the editor dispatch complexity decreased from 26 to 25.

@Jocs
Jocs merged commit f860c35 into develop Oct 27, 2026
8 checks 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.

改进代码编写缩进。Improve code section indentation writing.

1 participant