Issue Description
TLDR: The agent cannot read the output of the commands it runs in the terminal or wait for the command to finish, such as a build process.
I have identified consistent issues with how the terminal in Cursor IDE handles command execution and output display, even after adjusting the “Use Preview Box” setting as recommended. When executing commands in the terminal through the IDE’s interface, several problems persist that make debugging and development challenging:
-
PSReadLine errors continue: Despite disabling the Preview Box, PSReadLine errors with
ArgumentOutOfRangeException
still occur consistently, suggesting a deeper integration issue. -
Incomplete command output: While simple commands may show output, more complex commands with formatted output (like tables) still have inconsistent display.
-
Background task handling: Commands run in background mode still report as “running” or “interrupted” without showing their complete output.
-
Terminal history interference: Previous command outputs and errors continue to appear mixed with new command outputs.
Steps to Reproduce
- Open Cursor IDE
- Go to Settings > Preferences > Terminal and ensure “Use Preview Box” is enabled (as suggested in the workaround)
- Open the integrated chat in Agent Mode.
- Ask the agent to debug itself and execute a simple command:
echo "Test message"
- This may work as expected
- Execute a more complex command:
Get-Process | Select-Object -First 5 | Format-Table
- Notice the PSReadLine errors and incomplete output
- Try a background command:
Start-Sleep -Seconds 3; echo "Command completed after 3 seconds"
- Observe how it’s marked as “running in background” without showing completion
Workaround Testing Results
As suggested (Cannot See Output for Agent/Composer in Non-Interactive Terminal - #2 by danperks), I enabled the “Use Preview Box” setting in Settings > Preferences > Terminal. After testing this workaround:
Simple, single-line outputs (like
echo "Test message"
) work slightly betterPSReadLine errors still occur consistently
Complex command outputs (tables, lists) still display incorrectly
Background tasks still don’t show completion properly
Terminal history/state issues persist
Expected Behavior
- Terminal should display complete command outputs accurately
- No PSReadLine errors should appear during normal operation
- Background commands should report completion status and output correctly
- Each command’s output should be clearly separated from previous outputs
Actual Behavior
- PSReadLine errors continue to appear with the same
ArgumentOutOfRangeException
- Command outputs are often truncated, missing, or mixed with previous command history
- Background commands don’t properly display completion or output
- Complex outputs (tables, multi-line results) display poorly or not at all
Environment Information
- Operating System: Windows 11
- PowerShell Version: 7.4.6
- PSReadLine Version: 2.3.5
- Cursor Version: 0.46.8
- Settings: “Use Preview Box” enabled in Terminal preferences
Additional Information
The core issue appears to be related to how Cursor interfaces with PowerShell’s console handling, specifically the PSReadLine module. The consistent error is:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')
Actual value was 1.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
This suggests the terminal buffer is being initialized or managed incorrectly, regardless of the Preview Box setting.
Impact
This issue significantly impacts workflow as it:
- Makes debugging with terminal output unreliable
- Requires frequent manual verification of command execution
- Forces workarounds like redirecting output to files
- Makes multi-step command sequences difficult to track
Potential Solutions
- Provide an option to completely bypass PSReadLine for the integrated terminal
- Implement better buffer management for the PowerShell console
- Add a “raw mode” terminal option that prioritizes output reliability over features
- Consider implementing a more traditional terminal emulator with fewer integration points
Questions for the Community
- Has anyone found a more effective workaround than just disabling the Preview Box?
- Are there specific PowerShell profile settings that might help mitigate these issues?
- Does anyone know if this is being tracked as a known issue by the Cursor team?
Despite the suggested workaround, the core issues persist. I appreciate any additional suggestions while awaiting a more permanent fix.