fix(tui): v2 theme/clipboard/Shift+Enter, v3 arrow-nav/Shift+EnterFeat/tui v3 improvements#525
Merged
Merged
Conversation
/continue previously pushed plan_scan_baseline past every restored message, so plan_state.is_active() saw an empty slice and hid the card — even when the prior session's plan.md still had `[ ]` items the user wanted to keep working on. `working['in_plan_mode']` isn't replayed by the log restore either, so the card never came back. Make the baseline conditional: default to 0 so the scanner walks the full restored history; only push past it when the restored plan.md is already all-done, suppressing the stale ✓ card. Resolved-path missing or empty items naturally fall back to "no card". /stop now also refills the input box with the just-sent user message, so an interrupted send is one keystroke from edit-and-resend. Only when the box is empty (don't clobber a half-typed follow-up). Agent history is untouched — a resend duplicates the turn in LLM context; /rewind 1 is the manual escape. Behaviour matrix (/continue): unfinished plan → baseline=0, scanner finds path, card resumes completed plan → baseline=len(msgs), card stays hidden plan.md deleted → resolve_path None, card stays hidden fresh enter_plan_mode after continue → working flag re-arms, normal
- /export clip 现在通过 _copy_to_clipboard 直接写系统剪贴板: Win32 ctypes(CF_UNICODETEXT,避开控制台 codepage)/ macOS pbcopy / Wayland wl-copy / X11 xclip 或 xsel,失败再退回手动复制。 - InputArea 在 Windows 上对 Enter 事件用 GetAsyncKeyState(VK_SHIFT) 兜底, 终端把 Shift+Enter 报成普通 Enter 时也能正确插入换行而非提交。 - watch_theme 漏清 _seg_render_cache 导致主题切换后 Markdown 的 h1/列表 bullet/code 块/link 等仍是上一主题的色 —— 缓存 key 不含 theme,且 ANSI 颜色被烤进了 _MdRender。补上 clear()。 Refs: - Shift+Enter 物理检测思路 from upstream PR lsdefine#519 by @jlu005807 lsdefine#519
- _ptk_keypress_to_bytes 在 Windows 上对 Enter 收到 \r 时用 GetAsyncKeyState(VK_SHIFT) 物理检测 Shift,按下时返回 \n 以触发换行 (PTK 在某些 Windows 终端区分不出 Shift+Enter 与裸 Enter)。 - 新增 _line_region / _logical_visual_range 辅助函数,↑/↓ 按键: 不在该逻辑行的视觉首/末行 → 视觉滚行;在视觉首行且光标在行首 → 历史导航,否则先跳逻辑行首/尾,下次按键再跨行/进历史。多行粘贴 内部导航更符合直觉。 Refs: - Shift+Enter 物理检测 from upstream PR lsdefine#519 by @jlu005807 lsdefine#519 - 多行输入逻辑行边界导航思路 from upstream PR lsdefine#520 by @jlu005807 lsdefine#520
之前在任意逻辑行的视觉首/末行都会做"先跳行头/尾再跨行/进历史"的 两段式,中间行的两段式不直观。改成:中间逻辑行的视觉首/末行直接 做视觉上下移;只有第一逻辑行的视觉首行/最末逻辑行的视觉末行,才 触发"先跳到行头/尾,下次按键再进历史"。`_logical_visual_range` 因此变成死代码,顺手删掉。
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.
Overview
Small feature additions to tuiapp_v2 / tui_v3 plus a theme-switch bug fix, and a Windows-terminal Shift+Enter consistency pass across both.
tui_v2 (
7c9ce6b)/export clipnow actually copies to the system clipboard — adds_copy_to_clipboard: Win32 ctypes viaCF_UNICODETEXT(sidesteps console codepages),macOS
pbcopy, Linux Waylandwl-copy, or X11xclip/xsel. Falls back to printing the payload for manual copy on failure.Shift+Enteras plainEnter; InputArea now consultsGetAsyncKeyState(VK_SHIFT)so a physically-held Shift inserts a newline instead of submitting.watch_themepreviously failed to clearm._seg_render_cache, so existing assistant messages kept the previoustheme's colors on h1 / list bullets / code blocks / links after switching themes. The cache key didn't include theme, and the Rich theme palette was baked
into the ANSI of cached
_MdRenderobjects. Now cleared on every theme change.tui_v3 (
468f7e5,d477763)_ptk_keypress_to_bytes._line_regionhelper. With multi-line input:Refs
Test plan
Ctrl+Tcycles themes; existing messages with#headings, code blocks, lists, and links recolor immediately/export clipputs the full payload on the real clipboard (CJK intact, wrap preserved)Shift+Enterinserts a newline, plainEntersubmitshistory