Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 完善纯文本列表接续

zhangyongjie056af4b1cccd
diff --git a/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts b/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
index 985095aaf5..282dce0135 100644
--- a/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
+++ b/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
@@ -161,7 +161,7 @@ function serializeComposerDocument(
const quoteText = formatQuoteForSend(
composerQuoteAttrsToChatQuote(child.attrs as ComposerQuoteAttrs),
);
- if (prefix || continuationIndent) {
+ if (prefix || continuationIndent) {
// A quote chip inside a list item is part of that item. Keeping it
// in the current text block preserves the list marker. Put the
// encoded quote on its own continuation lines so history parsing
diff --git a/apps/desktop/src/renderer/lib/__tests__/composerListContinuation.test.ts b/apps/desktop/src/renderer/lib/__tests__/composerListContinuation.test.ts
index da99c9ce28..982085b818 100644
--- a/apps/desktop/src/renderer/lib/__tests__/composerListContinuation.test.ts
+++ b/apps/desktop/src/renderer/lib/__tests__/composerListContinuation.test.ts
@@ -11,6 +11,13 @@ describe('computeListContinuation', () => {
expect(computeListContinuation('12) bar')).toEqual({ action: 'continue', insert: '13) ' });
});
+ it('七位数序号正常自增', () => {
+ expect(computeListContinuation('999999. item')).toEqual({
+ action: 'continue',
+ insert: '1000000. ',
+ });
+ });
+
it('保留分隔符后的多余空白', () => {
expect(computeListContinuation('3. foo')).toEqual({ action: 'continue', insert: '4. ' });
});
@@ -29,7 +36,7 @@ describe('computeListContinuation', () => {
expect(computeListContinuation('5、')).toEqual({ action: 'exit' });
});
- it('光标在标记后、正文前(`1. |todo`)不算空项 → 接续拆分,不退出(codex P2)', () => {
+ it('光标在标记后、正文前(`1. |todo`)不算空项 → 接续拆分,不退出', () => {
// 光标前 = "1. "(rest 空),但光标后仍有 "todo" → 整行非空 → continue
expect(computeListContinuation('1. ', 'todo')).toEqual({ action: 'continue', insert: '2. ' });
// 光标后是空白也算空项
diff --git a/apps/desktop/src/renderer/lib/composerListContinuation.ts b/apps/desktop/src/renderer/lib/composerListContinuation.ts
index e17427cfac..e08109f9de 100644
--- a/apps/desktop/src/renderer/lib/composerListContinuation.ts
+++ b/apps/desktop/src/renderer/lib/composerListContinuation.ts
@@ -23,9 +23,9 @@ export interface ListPrefixMatch {
// checkbox 允许行在 `]` 处截止(`(\s+|$)`),这样 "- [ ]" 也能识别成空项退出。
const CHECKBOX_RE = /^(\s*)([-+*])(\s+)\[[ xX]\](\s+|$)/;
const BULLET_RE = /^(\s*)([-+*•])(\s+)/;
-const ORDERED_RE = /^(\s*)(\d{1,6})([.)])(\s+)/;
+const ORDERED_RE = /^(\s*)(\d{1,7})([.)])(\s+)/;
// 中文顿号序号(`1、`)不要求后随空格,符合中文输入习惯。
-const ORDERED_CJK_RE = /^(\s*)(\d{1,6})(、)(\s*)/;
+const ORDERED_CJK_RE = /^(\s*)(\d{1,7})(、)(\s*)/;
const QUOTE_RE = /^(\s*)(>)(\s+)/;
/**
diff --git a/apps/desktop/src/renderer/styles/globals.css b/apps/desktop/src/renderer/styles/globals.css
index 103be32e0d..a05318e176 100644
--- a/apps/desktop/src/renderer/styles/globals.css
+++ b/apps/desktop/src/renderer/styles/globals.css
@@ -113,8 +113,8 @@
/* F3: Global disable focus outline — Chromium default :focus-visible draws
a yellow/orange ring on buttons, options and menu items after Esc/click
- transitions focus. Claude Desktop has no such ring; suppress it on every
- non-input element. Inputs keep their focus hint via --*-border-focus. */
+ transitions focus. Suppress it on non-input elements while inputs keep
+ their focus hint via --*-border-focus. */
*:focus,
*:focus-visible {
outline: none !important;