feat(tui-v3): v2-style arrow navigation with logical line boundaries#520
Merged
Merged
Conversation
2572ee9 to
133c2fe
Compare
Contributor
|
good! |
nianyucatfish
added a commit
to nianyucatfish/GenericAgent
that referenced
this pull request
May 28, 2026
- _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
Merged
7 tasks
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.
新增 _logical_visual_range() (L2556-2564)
计算指定逻辑行在视觉行列表 segs 中的起止索引范围,用于判断光标是否在视觉首行/末行。
上键 ↑ 新逻辑
多行(buf中有\n) 且 在视觉首行?
├─ 第0行且已在行首 → _nav_hist(-1) 翻历史
├─ 第0行但不在行首 → pos=行首 跳行首
├─ 非第0行且已在行首 → _cur_v(-1) 正常上移(到上一行)
└─ 非第0行但不在行首 → pos=行首 跳该行行首
下键 ↓ 新逻辑
多行(buf中有\n) 且 在视觉末行?
├─ 末行且已在行末 → _nav_hist(1) 翻历史
├─ 末行但不在行末 → pos=行末 跳行末
├─ 非末行且已在行末 → _cur_v(1) 正常下移(到下一行)
└─ 非末行但不在行末 → pos=行末 跳该行行末
↑效果↓效果兼容性
• ✅ 不影响其他快捷键(←→/Ctrl+U/Ctrl+A/Home/End 等)
• ✅ 不影响命令补全调色板
• ✅ 不影响 pending 消息弹回
• ✅ 不新增外部依赖