Repository navigation
Conversation
记忆页把整篇 MEMORY.md 绑在一个 OutlinedTextField(minLines=6, maxLines=12) 上:
Compose 的文本框排版代价随全文线性增长,几十 KiB 文档在进入页面与每次输入时都要
重排整篇。实测表现为「记忆内容为空时不卡,字数一多就非常卡」。
改动:
- 新增 MemoryViewMode { Preview, Edit },卡片顶部两个文字按钮显式切换
- 默认按内容自动选:有内容先预览,空文档直接进编辑,不额外增加点击
- 预览用 LazyColumn 按行拆条虚拟化,只组合视口内的行;外层同为 LazyColumn,
按 Compose 约束给 heightIn(max) 明确高度上限
- 编辑仍用原 TextField,只有用户主动切到编辑时才承担整篇排版成本
- 文案 memory_view_mode_preview 补齐 en / zh-Hans / zh-Hant
行为差异仅限「默认先看预览」,编辑能力、保存、清空、字节计数与超限提示均未改动。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
记忆页把整篇
MEMORY.md绑在一个OutlinedTextField(minLines = 6, maxLines = 12)上。Compose 文本框的排版代价随全文线性增长,几十 KiB 文档在进入页面和每次输入时都要重排整篇。实测症状:记忆内容为空时不卡,字数一多就非常卡。
改法
MemoryViewMode { Preview, Edit },卡片顶部两个文字按钮显式切换LazyColumn按行拆条虚拟化,只组合视口内的行;外层同为LazyColumn,按 Compose 约束给heightIn(max = 320.dp)明确高度上限TextField,只有用户主动切到编辑时才承担整篇排版成本memory_view_mode_preview补齐 en / zh-Hans / zh-Hant兼容性
编辑、保存、清空、字节计数、超限提示逻辑均未改动。唯一行为差异是默认先展示预览。
验证
:app:compileDebugKotlin通过(release 构建亦通过)