Skip to content

feat(chat): continue Markdown lists on new lines in the composer - #884

Merged
agegr merged 1 commit into
agegr:mainfrom
Zhangs-11:feat/composer-list-continuation
Sep 29, 2026
Merged

agegr merged 1 commit into
agegr:mainfrom
Zhangs-11:feat/composer-list-continuation

Conversation

@Zhangs-11

Copy link
Copy Markdown
Contributor

Summary

  • continue Markdown lists when a line break is inserted inside a list item in the composer
  • ordered items advance their number and keep the delimiter (1. → 2., 1) → 2), zero padding kept); -, * and + bullets repeat; task items continue unchecked (- [x] → - [ ]); indentation is preserved for nested items
  • a line break on an empty item clears the marker and ends the list
  • Chinese enumerations typed as 1、 continue as well (up to three digits, so lines such as 2020、2021年… are left alone)

Behavior

The composer listens for the textarea's native insertLineBreak input instead of a key combination, so the same path covers desktop Shift+Enter and mobile Enter. Sending (Enter on desktop, Ctrl/Cmd+Enter on mobile), slash/@/history menu selection and IME confirmations never produce that input and are unchanged.

A plain newline is kept when:

  • the caret is on a line that is not a list item, or is before/inside the marker
  • the line is a thematic break (---, * * *, - - -)
  • the line is inside a fenced code block (``` or ~~~)
  • text is selected

The edit is applied with insertText, so it stays on the browser's undo stack (one Ctrl/Cmd+Z removes the inserted marker) and flows through the existing onChange path for drafts, the @ picker and resizing.

Validation

  • npm test — 1045 tests passed (new lib/markdown-list-continuation.test.mjs covers ordered, bullet, task, nested, split-at-caret, empty-item exit, Chinese enumerations, non-list lines, caret inside the marker, fenced code and selections)
  • node_modules/.bin/tsc --noEmit
  • npm run lint
  • git diff --check
  • real browser QA in Chromium on the PR branch: Shift+Enter continuation for ordered, task and 1、 lists; empty item ends the list; one undo restores the text before the line break; a non-list line still gets a plain newline; at a 390px mobile viewport, plain Enter continues 1) lists and exits on an empty item
  • not verified in Firefox or Safari

🤖 Generated with Claude Code

Inserting a line break inside a list item starts the next item: ordered
numbers advance and keep their delimiter, bullets and task items repeat
(checked tasks continue unchecked), and indentation is preserved. A line
break on an empty item clears the marker and ends the list. Chinese
enumerations such as "1、" continue as well.

The composer listens for the textarea's native insertLineBreak input, so
desktop Shift+Enter and mobile Enter share one path while sends and IME
confirmations are untouched. Lines inside fenced code, thematic breaks and
selections keep the native newline, and the edit stays on the undo stack.

Co-Authored-By: Claude Opus 5 <[email protected]>
@agegr
agegr merged commit fd037e4 into agegr:main Sep 29, 2026
2 checks passed
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
…gr#884)

Inserting a line break inside a list item starts the next item: ordered
numbers advance and keep their delimiter, bullets and task items repeat
(checked tasks continue unchecked), and indentation is preserved. A line
break on an empty item clears the marker and ends the list. Chinese
enumerations such as "1、" continue as well.

The composer listens for the textarea's native insertLineBreak input, so
desktop Shift+Enter and mobile Enter share one path while sends and IME
confirmations are untouched. Lines inside fenced code, thematic breaks and
selections keep the native newline, and the edit stays on the undo stack.

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit fd037e4)
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
上游已合并的 agegr#884/agegr#871/agegr#996 我们已同步(代码与上游一致),agegr#892 已回退,
四行都不再是取舍信息,删掉;保留的都是上游仍未合并(我们领先)或被我们
拒绝的 PR。顺带修掉 agegr#907 的理由措辞:状态列里出现「已摘取」会让
scripts/prs.sh 把它误判成已摘取。
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
…#907 agegr#941 agegr#946 agegr#961 agegr#968 agegr#969 agegr#1007 agegr#1008 agegr#1009 agegr#1010)

上游已把我们提前摘取的 agegr#884 / agegr#871 / agegr#996 / agegr#961 原样合并(agegr#961 逐字节相同),
agegr#967 与 agegr#963 由上游的 agegr#1009 / agegr#1008 接管。

冲突解决:
- demo/ 对齐上游 fe288c0,撤销 agegr#963 对 demo 的两处改动(`@/lib/chat-phase-label`
  在 demo/lib 下不存在,会打断 Pages 构建)。
- AGENTS.md:保留我们的 default-project 条目,open-folder 换成上游的
  open-in-explorer。
- MessageView.tsx / SessionSidebar.tsx / FileExplorer.tsx:以上游为准,
  DismissButton 采用上游的独立文件,保留我们的思考卡片与文件管理改动。
- SessionSidebar 移除引用已删函数的旧 agegr#951 工作区按钮(agegr#951 的其他入口另行收尾)。
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 6, 2026
…gr#884)

Inserting a line break inside a list item starts the next item: ordered
numbers advance and keep their delimiter, bullets and task items repeat
(checked tasks continue unchecked), and indentation is preserved. A line
break on an empty item clears the marker and ends the list. Chinese
enumerations such as "1、" continue as well.

The composer listens for the textarea's native insertLineBreak input, so
desktop Shift+Enter and mobile Enter share one path while sends and IME
confirmations are untouched. Lines inside fenced code, thematic breaks and
selections keep the native newline, and the edit stays on the undo stack.

Co-authored-by: Claude Opus 5 <[email protected]>
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 8, 2026
…gr#884)

Inserting a line break inside a list item starts the next item: ordered
numbers advance and keep their delimiter, bullets and task items repeat
(checked tasks continue unchecked), and indentation is preserved. A line
break on an empty item clears the marker and ends the list. Chinese
enumerations such as "1、" continue as well.

The composer listens for the textarea's native insertLineBreak input, so
desktop Shift+Enter and mobile Enter share one path while sends and IME
confirmations are untouched. Lines inside fenced code, thematic breaks and
selections keep the native newline, and the edit stays on the undo stack.

Co-authored-by: Claude Opus 5 <[email protected]>
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