qwen-code/patches
ChiGao 81f1ffb94c
fix(cli): correct hardware cursor off-by-one in fullscreen mode (#7998)
* fix(cli): correct hardware cursor off-by-one in fullscreen mode

In fullscreen mode Ink omits the trailing newline, so after writing
output the terminal cursor sits ON the last line rather than one past
it. buildCursorSuffix assumed the latter and emitted one extra
cursorUp, placing the hardware cursor (used for IME positioning) one
row above the software block cursor — visible as an extra white
rectangular segment protruding above the input line.

Pass a hasTrailingNewline flag through buildCursorSuffix,
buildReturnToBottom, buildCursorOnlySequence, and
buildReturnToBottomPrefix in the Ink patch so both the standard and
incremental log-update renderers compute the correct cursor movement.

Closes #7980

* fix(cli): revert incorrect hasTrailingNewline in buildReturnToBottom

Self-review caught that buildReturnToBottom does NOT need the
hasTrailingNewline adjustment: its previousLineCount argument comes
from str.split('\n').length, which already includes the trailing
empty element when the output ends with '\n'. The original formula
(previousLineCount - 1 - y) is the exact inverse of the corrected
buildCursorSuffix in both fullscreen and non-fullscreen modes.

Only buildCursorSuffix needs the flag, because its visibleLineCount
argument excludes the trailing empty element.

* fix(cli): sync cursor-helpers.d.ts and add fullscreen cursor-only test (#7998)

---------

Co-authored-by: 秦奇 <gary.gq@alibaba-inc.com>
Co-authored-by: Qwen Code Bot <qwen-code-bot@users.noreply.github.com>
2026-07-29 06:40:53 +00:00
..
ink+7.0.3.patch fix(cli): correct hardware cursor off-by-one in fullscreen mode (#7998) 2026-07-29 06:40:53 +00:00