myclaude -r: 清块后 \r 归位列 0,修复 Resuming 前空格式错位

raw 模式下 ONLCR 关闭,_draw_picker_block 每行以 \n 结尾时光标停在行末列而非列 0;\x1b[12A 上移、\x1b[12M 删除后列不变,rich console.print 的 Resuming 从 ~40 列打印,前面出现一长串空格。清块后补 \r 归位。
This commit is contained in:
Zhengshou Lai
2026-08-16 00:06:44 +08:00
parent 4a37d8d218
commit fa792674d3
+4
View File
@@ -1048,10 +1048,14 @@ def _clear_picker_block(prev_height: int) -> None:
Uses Delete Line (``CSI n M``) rather than blanking lines, so the block Uses Delete Line (``CSI n M``) rather than blanking lines, so the block
disappears entirely instead of leaving N empty rows below the prompt. disappears entirely instead of leaving N empty rows below the prompt.
Ends with ``\r`` so the next writer (``console.print`` of the Resuming
line, or the shell prompt) starts at column 0, not wherever the block's
last row left the cursor.
""" """
if prev_height: if prev_height:
sys.stdout.write(f"\x1b[{prev_height}A") sys.stdout.write(f"\x1b[{prev_height}A")
sys.stdout.write(f"\x1b[{prev_height}M") sys.stdout.write(f"\x1b[{prev_height}M")
sys.stdout.write("\r")
sys.stdout.flush() sys.stdout.flush()