feat(cosh): add large paste placeholder and fix placeholder id reset on esc cancel#312
Open
kongld-mq wants to merge 5 commits into
Open
feat(cosh): add large paste placeholder and fix placeholder id reset on esc cancel#312kongld-mq wants to merge 5 commits into
kongld-mq wants to merge 5 commits into
Conversation
…on esc cancel - Create placeholder for pastes >1000 chars or >10 lines instead of full content - Support sequential IDs for multiple pastes of same size with reuse mechanism - Atomically delete placeholder on Backspace - Expand placeholder to full content on submit - Use pasteWorkaround check for macOS Enter-fix to prevent double-submit - Handle clipboard errors with debugLogger instead of console.error - Clear pendingPastes and activePlaceholderIds on double ESC to reset ID counter - Add 9 new test cases covering placeholder creation, expansion, deletion, reuse, and ESC reset Signed-off-by: konglidong <kld02270359@alibaba-inc.com>
|
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
samchu-zsl
reviewed
May 8, 2026
Collaborator
samchu-zsl
left a comment
There was a problem hiding this comment.
Summary
非常棒的功能扩展 🎉 —— 大粘贴占位符、ID 复用、ESC 重置整体思路清晰,测试用例也覆盖了主要正向路径。以下留下 4 条具体改动建议,按建议处理后整体可以合入:
🟡 Major(建议修复)
- UTF-16 vs code-point 偏移混用(
InputPrompt.tsxL878-L892):backspace 删除占位符的路径里,buffer.lines[i].length与text.slice走 UTF-16,而buffer.cursor的 col 和replaceRangeByOffset走 code-point,混用后只要用户在占位符前输入了 emoji 等非 BMP 字符就会错位。 - 占位符被部分删除后原文静默丢失(
InputPrompt.tsxL867-L907):当前仅匹配「光标恰好在占位符尾」,若用户按 ← 进入占位符内部或从下一行回退再 backspace,占位符字符串被逐字破坏,而pendingPastes仍持有完整 key,提交时正则匹配失败,用户拿到残缺占位符而非原文。 recentPasteTimegating 语义变化缺测试(InputPrompt.tsxL798):加了pasteWorkaround &&后,原来的 paste-auto-submission 保护测试因为默认pasteWorkaround=false,实际已经不再走到保护分支了;建议补一条pasteWorkaround=true下的回归测试。
ℹ️ Minor
- 占位符文案硬编码(
InputPrompt.tsxL179):同文件已经import { t },建议走 i18n。
感谢贡献!
…laceholder backspace deletion logic Signed-off-by: konglidong <kld02270359@alibaba-inc.com>
…loss when backspace is pressed inside placeholder range Signed-off-by: konglidong <kld02270359@alibaba-inc.com>
…bmission protection Signed-off-by: konglidong <kld02270359@alibaba-inc.com>
Review issue alibaba#4: Add i18n support for placeholder display text - Use t('input.paste.placeholder', { charCount }) for localized text - Add keys in locales/en.js and locales/zh.js - Placeholder marker uses Unicode private area char (\uE000) Backspace deletion fixes: - Fix sequence number disorder: sync pendingPastes with actual markers in buffer, cleanup orphan entries and release their IDs - Fix emoji/non-BMP char deletion error: use code-point semantics (toCodePoints + cpSlice) instead of UTF-16 indexing - Cursor movement correctly handles placeholder boundaries
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.
Description
feat(cosh): add large paste placeholder and fix placeholder id reset on esc cancel
pasteWorkaround is enabled (Windows or Node < 20). On macOS/Linux with
modern Node, bracketed paste markers work reliably so the protection is
unnecessary and caused the first Enter after paste to be ignored.
Related Issue
closes #
Type of Change
Scope
cosh(copilot-shell)sec-core(agent-sec-core)skill(os-skills)sight(agentsight)Checklist
cosh: Lint passes, type check passes, and tests passsec-core(Rust):cargo clippy -- -D warningsandcargo fmt --checkpasssec-core(Python): Ruff format and pytest passskill: Skill directory structure is valid and shell scripts pass syntax checksight:cargo clippy -- -D warningsandcargo fmt --checkpasspackage-lock.json/Cargo.lock)Testing
After generating the test text, paste it into the input box
large text test(>1000 chars)
Multi-line test (>10 lines)
Small text test(<1000 chars)
Additional Notes
#2