Reviewed PR details and related issues.
UnderstandConfirmed cursor visibility behavior on shutdown.
UnderstandNoted push failure due to unstaged changes.
VerifyYou are given one or more GitHub PR URLs: https://github.com/badlogic/pi-mono/pull/800 why does the current code break ime positioning? cant we hide the cursor while still set the cursor position for ime?
For each PR URL, do the following in order:
packages/*/CHANGELOG.md files. Report whether an entry exists. If missing, state that a changelog entry is required before merge and that you will add it if the user decides to merge. Follow the changelog format rules in AGENTS.md. Verify:
### Breaking Changes, ### Added, ### Fixed, etc.)Fixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))### Breaking Changes, not just ### FixedOutput format per PR: PR: Changelog:
If no issues are found, say so under Bad and Ugly.
Planning PR details retrieval
I'll use gh pr view with JSON output to read the PR and also fetch related issue details, ensuring to access files via the read tool if needed.
>gh pr view 800 --json title,body,comments,commits,filesDeciding to use GH PR diff for reading diffs
I confirmed the instructions recommend using gh pr diff to read pull request diffs, so I'll proceed with that to access the full diff including comments and other details.
>gh pr diff 800Planning full file reads for inspection
I'm prioritizing reading relevant full files from main to understand issue with IME positioning, especially in terminal cursor handling and hardware cursor usage. Next, I'll review key files and related code paths to pinpoint the cause.
Listing directory contents
>ls /Users/badlogic/workspaces/pi-mono/packages/tui/src/terminalLocating terminal executable path
>find /Users/badlogic/workspaces/pi-mono/packages/tui/src -maxdepth 2 -type f -name "*terminal*"Checking terminal usage
I'm verifying how terminals are invoked and used in the root and process-terminal contexts to understand their roles before proceeding.
>find /Users/badlogic/workspaces/pi-mono/packages/tui/src -maxdepth 2 -type f -name "*process*"Investigating terminal process handling
I'm examining the ProcessTerminal implementation in the terminal.ts file to understand how terminal processes are managed.
Checking changelog entries in main branch
I'm reading the full changelog files under packages/coding-agent and packages/tui to verify PR changelog entries in the main branch version.
Planning full file reads beyond limit
The interactive-mode file exceeds 50KB, so to obey the full-read requirement, I'll use multiple read calls with offsets to capture the entire file despite the instruction against offset use in one read.
Analyzing IME cursor breakage
Current code disables hardware cursor movement when hardware cursor use is off, causing the IME to rely on an outdated cursor position, which breaks IME positioning since the cursor isn't moved though it might be hidden.
Considering cursor hide-with-move and docs check
Hiding the cursor while still moving it may require toggling hide after moving since the code doesn't support moving without showing; IME candidates likely depend on cursor visibility or position. I'll also check the coding-agent README and docs for any needed updates due to the new hardware cursor setting.
Reviewing hardwareCursor setting and IME handling
I'm noting the README likely needs updates to include the new hardwareCursor setting and related env var. The current code hides the cursor unconditionally when hardwareCursor is false, which may conflict with IME use cases that require moving the cursor while it remains hidden. This suggests a need to allow hiding the cursor without disabling cursor positioning for better IME compatibility.
Reviewing hardwareCursor addition and IME cursor behavior
The PR adds a hardwareCursor setting with runtime toggle and updates changelogs in coding-agent and tui, but both lack proper PR attribution and author metadata. The README settings table omits hardwareCursor and its env var PI_HARDWARE_CURSOR, so it needs updating to clarify their relationship. The current TUI implementation disables cursor positioning when hardwareCursor is false by hiding the cursor and returning early, which breaks IME candidate window tracking since IME relies on cursor position updates. While it is technically possible to move a hidden cursor, the existing code always shows the cursor after moving, preventing hidden positioning. This suggests a need to separate cursor visibility from positioning to support IME scenarios. The PR adds UI toggle support aligned with the new setting. No tests were added or run, and no related issues exist. Questions remain about terminal compatibility with positioning hidden cursors and whether a "position-only" mode should be introduced.
PR: https://github.com/badlogic/pi-mono/pull/800 Changelog:
i think we don't need a setting. we need to differntiate between cursor positioning (always on!) and hardware cursor visibility (toggle via ENV var). can you please check how we can always position the cursor, but make visibility toggleable?
Proposing cursor positioning refactor
I'm planning to separate hardware cursor positioning from visibility by removing the early return in positioning, always updating cursor position if available, and controlling show/hide via a dedicated flag—potentially an env var—to improve semantics and flexibility. I'll suggest updating README to document the new environment variable controlling cursor visibility.
Detailing cursor positioning mechanism
I'm outlining how to always position the hardware cursor in the rendering flow by modifying the flag logic in the main TUI file to separate movement from visibility. The plan clarifies handling cursor presence, overlay interactions, and naming updates for cursor visibility control while preserving current overlay hide/show calls.
Yes. The current behavior in packages/tui/src/tui.ts short-circuits cursor positioning when useHardwareCursor is false. That means the cursor is never moved, so IME candidate windows anchor to a stale position.
To always position the cursor while making visibility toggleable, split the concerns:
Concrete approach in TUI:
showHardwareCursor = process.env.PI_HARDWARE_CURSOR === "1" or rename the existing useHardwareCursor to showHardwareCursor.positionHardwareCursor, remove the early return that skips movement when the flag is false.cursorPos is available and totalLines > 0, regardless of visibility.showCursor() only if visibility is enabled. Otherwise call hideCursor().Pseudo-change inside positionHardwareCursor:
if (!cursorPos || totalLines <= 0) { this.terminal.hideCursor(); return;}
move cursor to target row and colthis.hardwareCursorRow = targetRow
if (this.showHardwareCursor) this.terminal.showCursor()else this.terminal.hideCursor()That keeps IME positioning stable while allowing visibility control.
If we remove the new coding-agent setting, we should also remove:
We would keep PI_HARDWARE_CURSOR as visibility only. If you want me to implement these changes, say so.
well, we haven't merged the pr yet, so i think we can just make this change in main. we can still. so
agree?
Planning cursor rename and behavior changes
I'm renaming useHardwareCursor to showHardwareCursor with getter/setter, adjusting constructor and visibility accordingly. The hardware cursor will always position if a cursorPos exists but hide if showHardwareCursor is false, still moving the cursor even when hidden. I'll update changelog entries in packages/tui and coding-agent under Unreleased.
Detailing hardware cursor setting integration
I'm updating TUI to rename and expose showHardwareCursor with getter/setter, adjusting constructor and cursor positioning logic to always move but conditionally show or hide the cursor. I'm adding showHardwareCursor to settings-manager and selector with UI integration and updating interactive-mode to apply it. I’ll also update the coding-agent README to document the new setting and add changelog entries reflecting these changes.
Renaming and adjusting cursor logic
I'm renaming useHardwareCursor to showHardwareCursor and updating its logic accordingly, focusing on handling editable blocks.
Searching for obsolete hardware cursor references
I'm checking for any remaining references to the deprecated hardware cursor usage by searching the codebase with bash grep to ensure all are updated or removed.
>rg -n "useHardwareCursor|showHardwareCursor" /Users/badlogic/workspaces/pi-mono/packages/tui/src/tui.tsAdding hardware cursor setting
I'm updating the settings manager to include a new showHardwareCursor property with getter and setter methods, placing it near editorPaddingX and linking it to the PI_HARDWARE_CURSOR environment variable.
Planning method insertion near padding getter
I'm adding getShowHardwareCursor and setShowHardwareCursor methods near the existing getEditorPaddingX method, positioning them just before it and after setDoubleEscapeAction to keep related editor settings grouped logically.
>rg -n "getEditorPaddingX" -n /Users/badlogic/workspaces/pi-mono/packages/coding-agent/src/core/settings-manager.tsInserting methods within specific code range
Adding hardware cursor setting
I'm updating settings types and UI to include a showHardwareCursor option with its config entry, callback, toggle item, and handling logic in the switch.
Planning hardware cursor insertion
I'm locating the section that inserts skill commands and editor padding to insert the hardware cursor entry between them by replacing the editor padding insertion block. Next, I'll review the relevant code snippet for accurate editing.
Planning insertion after skill commands
Updating switch in settings list
Adding hardware cursor case
I'm adding a case for "show-hardware-cursor" and applying the changes using edit.
Verifying snippet indentation with tabs
Adding new case with edit
Planning text replacement with exact spacing
Confirming indentation details
I'm verifying that the indentation uses tabs rather than spaces and deciding to capture a larger code block for exact matching to avoid confusion with whitespace characters.
Investigating indentation inconsistencies
I'm checking if tabs or spaces indent the target code block, considering potential CRLF issues, and exploring precise edits by matching existing indentation via exact line strings from reading, aiming to replace the case block without mismatches.
Preparing precise edit with tabs
I'm planning to insert the new case before the existing one by matching the exact line with four tabs indentation, ensuring the edit uses the correct tab characters for accurate replacement.
Updating TUI constructor with hardware cursor setting
I'm adding showHardwareCursor to settings and passing it via the TUI constructor instead of using the default ProcessTerminal call. I confirmed settings are already loaded, so no need to re-read the config file.
Adding showHardwareCursor to settings config
>rg -n "showSettingsSelector" -n /Users/badlogic/workspaces/pi-mono/packages/coding-agent/src/modes/interactive/interactive-mode.tsAdding showHardwareCursor to config
Planning to add the showHardwareCursor property in the config object and related callbacks, inserting it after doubleEscapeAction using an edit operation.
Adding hardware cursor change callback
Updating hardware cursor config and usage
I've added the new showHardwareCursor property in the config and callback interfaces, updated constructor signatures accordingly, and ensured interactive-mode calls the updated TUI method for setting hardware cursor visibility; now confirming no other files use these methods before finalizing exports.
>rg -n "setUseHardwareCursor|useHardwareCursor" /Users/badlogic/workspaces/pi-monoUpdating cursor setting integration
I'm adding the showHardwareCursor property to the settings JSON and interface, updating its usage in the tui code, and documenting it in the settings table and JSON example in the README while referencing the existing env var note.
Locating JSON snippet in README
I'm searching for the editorPaddingX setting example in the README to add the showHardwareCursor entry nearby in the JSON settings example.
>rg -n "editorPaddingX" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/README.mdAdding showHardwareCursor setting
Planning to insert "showHardwareCursor": false into the JSON example, placed after the images block and before extensions; adding editorPaddingX is considered but not necessary since it's absent currently.
Inserting showHardwareCursor table row after blockImages
Decided to add the showHardwareCursor row after images.blockImages, as it's more related to terminal settings than editor padding or escape actions. I'll proceed with that insertion.
Verifying full changelog read
I realized the changelog read was likely truncated at 50KB, which risks missing existing entries; since editing requires full context, I need to reread the entire changelog file without limits before updating it.
Planning segmented changelog reads
Since the changelog exceeds 50KB and the read tool truncates, I'll read it in multiple segments using offsets and limits to ensure full coverage, balancing the requirement to read entire files with the tool's constraints.
Updating changelogs with new Added sections
I'll add an "Added" subsection under the "Unreleased" heading in both the main changelog and packages/tui/CHANGELOG.md if missing, then insert the new entry about the showHardwareCursor setting.
Adding changelog entry
Reviewing showHardwareCursor integration
I confirmed updating the settings-selector config and SettingsConfig interface, as well as the coding-agent settings JSON and settings table. Next, I plan to check for any other uses of showHardwareCursor across the codebase to ensure consistent integration.
>rg -n "showHardwareCursor" /Users/badlogic/workspaces/pi-monoChecking SettingsSelector usage across codebase
>rg -n "SettingsSelectorComponent" /Users/badlogic/workspaces/pi-mono/packages/coding-agent/srcFinalizing cursor setting updates
The cursor positioning now moves even when showing the hardware cursor is disabled, with initial hiding handled accordingly; relevant settings selectors and interface comments are updated without introducing em dashes, and no further code or documentation changes appear necessary.
Completing cursor feature integration
The new showHardwareCursor setting is integrated into the interactive settings UI and TUI actions, with cursor hiding and positioning behavior adjusted accordingly; no type errors or docs updates needed, and no tests have been run.
Summary:
Tests not run.
oki, looks great, changelog needs citation of pr and contributor, then commit and push JUST the files you modified
Clarifying changelog attribution
I'm assessing whether to include a PR link or contributor in the changelog entry but see the change is a direct internal commit without a PR or issue; I'll likely omit the PR link since none applies and follow internal changelog rules accordingly.
Including PR link and author in changelog
I'll update both changelog entries to cite PR 800 and contributor @ghoulr per user request, then commit and push only the modified files with these edits.
>git status --shortAdding and committing only specific files
I'll add and commit just the new or changed files related to this work, ignoring unrelated modifications, then run the required code checks via npm run check before committing.
>npm run checkFlagging check failure due to unrelated unused import
The check failed because of an unused import in an untracked file not created by us, preventing commit despite instructions to fix all errors. We can't safely modify that file ourselves and should inform the user that the error must be resolved before proceeding or confirm how to handle this external warning.
Requesting user guidance on unrelated lint failure
The lint check failed due to an unused import in an untracked file from other work, blocking commit despite user request. I'll inform the user of this issue and ask whether to fix and include that file in the commit or proceed otherwise, while noting which files are ready to commit.
npm run check failed due to an unrelated untracked file: packages/coding-agent/examples/extensions/trigger-compact.ts has an unused import. That file is not part of our changes and is currently untracked.
How do you want to proceed?
Options:
Once confirmed, I will commit and push only these files:
try again npm run check
>npm run checkChecking git status
>git status --shortIsolating commits to only agent files
There are unexpected unrelated file changes present that must not be staged or committed. I'll restrict git add to only the files modified by the agent and skip all others to avoid touching other agents' files.
Confirming full file reads before commit
Although edits are done, I'll read the full contents of modified files now to align with instructions before committing only the agent-modified files, ensuring unrelated changes aren't included.
>git add packages/tui/src/tui.ts packages/tui/CHANGELOG.md packages/coding-agent/src/core/settings-manager.ts packages/coding-agent/src/modes/interactive/components/settings-selector.ts packages/coding-agent/src/modes/interactive/interactive-mode.ts packages/coding-agent/README.md packages/coding-agent/CHANGELOG.mdConfirming staged changes
>git status --shortPreparing commit with message
I'm finalizing the commit with a message highlighting the IME cursor positioning fix and referencing the coding-agent.
>git commit -m "fix(tui): always position cursor for IME"Completing commit and pushing
>git pushPreparing to run pull with rebase
>git pull --rebase>git pullif (!cursorPos || totalLines <= 0) { this.terminal.hideCursor(); return;}
move cursor to target row and colthis.hardwareCursorRow = targetRow
if (this.showHardwareCursor) this.terminal.showCursor()else this.terminal.hideCursor()