fix(diff-viewer): cap comment editor width for readability on wide panes - #903
Merged
Conversation
Comment editors previously spanned the full pane width, so on a wide monitor with the viewer fullscreen, review comment text stretched nearly edge to edge and was hard to read. Clamp the range and line comment editor layouts to a 640px max width, keeping the existing full-width behavior on narrower panes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
The narrow-pane width assertions hard-coded 500 - 24, silently encoding the implementation's default paneHorizontalPadding of 12. Pass the editor height and padding explicitly and assert against a named PANE_HORIZONTAL_PADDING constant so the tests no longer depend on the implementation defaults. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
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.
Summary
The inline comment editor in the diff viewer stretched to fill the full pane width, so on a fullscreen viewer or a wide monitor comment text ran edge to edge and became hard to read.
Both
buildRangeCommentEditorLayoutandbuildLineCommentEditorLayoutnow clamp the editor width to a newMAX_COMMENT_EDITOR_WIDTH(640px), a comfortable prose measure. Narrow panes are unaffected — they still get the full pane width minus horizontal padding.Changes
packages/diff-viewer/src/lib/utils/diffViewerHelpers.ts: exportMAX_COMMENT_EDITOR_WIDTHand applyMath.min(...)in both comment editor layout builders.packages/diff-viewer/src/lib/utils/diffViewerHelpers.commentLayout.test.ts: new tests covering the narrow-pane (full width) and wide-pane (clamped) cases for both builders.