Skip to content

fix(cli): preserve resize renderer state - #45586

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-28a95171
Jun 13, 2026
Merged

fix(cli): preserve resize renderer state#45586
teknium1 merged 1 commit into
mainfrom
hermes/hermes-28a95171

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Classic CLI resize recovery now preserves prompt_toolkit's live cursor cache before resize erases, preventing duplicated prompt/input artifacts while keeping CJK-aware input-height calculation shared and tested.

Changes

  • cli.py: run prompt_toolkit's original resize handler before any Hermes renderer reset/invalidate so renderer.erase() can clear from the correct prompt origin.
  • cli.py: extract _estimate_tui_input_height() so prompt width is counted only on logical line 0 and CJK/wide characters use terminal cell width.
  • tests/cli: replace duplicated test-local input-height code with direct invariant tests for the shared helper and resize call order.

Related reports / PRs

Validation

Check Result
python3 -m py_compile cli.py pass
scripts/run_tests.sh tests/cli/test_cli_force_redraw.py tests/cli/test_cli_status_bar.py tests/cli/test_cli_terminal_response_sanitizer.py 70 passed, 0 failed

Infographic

cli-resize-artifacts

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-28a95171 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10887 on HEAD, 10889 on base (✅ -2)

🆕 New issues (2):

Rule Count
unresolved-attribute 2
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
run_agent.py:2891: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`

✅ Fixed issues (3):

Rule Count
unresolved-import 2
invalid-assignment 1
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
tests/cli/test_cli_status_bar.py:163: [unresolved-import] unresolved-import: Cannot resolve imported module `prompt_toolkit.utils`
tests/cli/test_cli_status_bar.py:162: [unresolved-import] unresolved-import: Cannot resolve imported module `prompt_toolkit.application`

Unchanged: 5709 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants