fix: make PTY width configurable to prevent output truncation#446
Open
timblaktu wants to merge 2 commits intostevearc:masterfrom
Open
fix: make PTY width configurable to prevent output truncation#446timblaktu wants to merge 2 commits intostevearc:masterfrom
timblaktu wants to merge 2 commits intostevearc:masterfrom
Conversation
When overseer runs tasks with use_terminal=true (the default), it sets a PTY width of vim.o.columns - 4. This causes compiler output to be truncated when the Neovim window is narrow, as programs detect the terminal width and adjust their output accordingly. This commit adds a new pty_width option to the jobstart strategy that allows users to: - Use the default auto behavior (vim.o.columns - 4) - Set a fixed width to prevent truncation - Set to nil to not specify any width constraint Fixes issue stevearc#202
4a32b54 to
280cf2e
Compare
- Add flake.nix with nixvim-based test environment - Add reproducer script demonstrating the truncation issue - Add documentation explaining the issue and how to test the fix - Includes C++ test file with intentionally long error messages
280cf2e to
2b0724f
Compare
stevearc
requested changes
Dec 30, 2025
Owner
stevearc
left a comment
There was a problem hiding this comment.
I'm fine with making the width configurable, but this could be simplified to a 3 or 4 line change. Also, please remove all the unrelated files before we merge.
Comment on lines
+16
to
23
| --- pty_width nil|integer|string Width of the PTY when use_terminal is true. Can be a number, "auto" (vim.o.columns - 4), or nil (no width specified) | ||
| ---@return overseer.Strategy | ||
| function JobstartStrategy.new(opts) | ||
| opts = vim.tbl_extend("keep", opts or {}, { | ||
| preserve_output = false, | ||
| use_terminal = true, | ||
| pty_width = "auto", | ||
| }) |
Owner
There was a problem hiding this comment.
This merge strategy won't work as advertised; if you pass in nil it will be overridden by the tbl_extend to be "auto" instead. Also, passing a nil width doesn't mean "no width constraints", it means we will use the default value of the current window width minus the offset due to line numbers etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When overseer runs tasks with
use_terminal=true(the default), it sets a PTY width ofvim.o.columns - 4. This causes compiler output and other program output to be truncated when the Neovim window is narrow (~100 columns or less), as programs detect the terminal width and adjust their output accordingly.This is especially problematic for compiler error messages that get cut off in the quickfix window, making debugging difficult.
Solution
This PR adds a new
pty_widthoption to the jobstart strategy that allows users to configure the PTY width behavior:"auto"(default): Current behavior - usesvim.o.columns - 4<number>: Set a fixed width (e.g.,500) to prevent truncationnil: Don't specify any width constraint, letting the PTY use its defaultUsage Examples
Prevent truncation with a fixed width:
Disable width specification entirely:
Keep current behavior (default):
Testing
Tested with narrow Neovim windows (~100 columns) running C++ compilation with long error messages. With
pty_width = 500, error messages are no longer truncated in the quickfix window.Breaking Changes
None - the default behavior remains unchanged. This is a backward-compatible enhancement.
Related Issues