Skip to content

lower min terminal width needed#97

Merged
dhth merged 1 commit intomainfrom
lower-min-terminal-width-needed
Aug 18, 2025
Merged

lower min terminal width needed#97
dhth merged 1 commit intomainfrom
lower-min-terminal-width-needed

Conversation

@dhth
Copy link
Owner

@dhth dhth commented Aug 18, 2025

Summary by CodeRabbit

  • New Features
    • Reduced minimum terminal width to 80 characters (from 96).
  • Bug Fixes
    • Improved behavior when the terminal is too small, with clearer exit instructions and more consistent message handling in that view.
  • Documentation
    • Clarified changelog entries: specified “date range limit for stats and log commands” and updated key references to “esc/q.”
  • Tests
    • Added a test to validate terminal width resizing behavior for logs.

@coderabbitai
Copy link

coderabbitai bot commented Aug 18, 2025

Walkthrough

Updates UI behavior: message frame countdown and clearing now skip when the insufficient-dimensions view is active. Minimum terminal width reduced from 96 to 80, and the insufficient-dimensions message formatting adjusted. A new test validates width resizing behavior. CHANGELOG entries updated accordingly.

Changes

Cohort / File(s) Summary
Changelog updates
CHANGELOG.md
Clarified date range limit wording; adjusted TUI navigation key text; noted minimum terminal width reduced to 80.
UI control-flow and layout
internal/ui/update.go, internal/ui/view.go
Update logic now gates message countdown/clearing based on active view (skips during insufficient-dimensions view). Reduced minWidthNeeded from 96 to 80; tweaked insufficient-dimensions message indentation and split exit instruction across two lines.
Tests
internal/ui/view_test.go
Added TestTerminalWidthResizingWorks for taskLogView; adjusted createTestModel initial WindowSizeMsg width to 96; uses minWidthNeeded in resize message; snapshot assertion added.

Sequence Diagram(s)

sequenceDiagram
  participant Timer as Tick/Update loop
  participant Model as UI Model.Update
  participant View as ActiveView
  participant Msg as MessageState

  Timer->>Model: Update(msg)
  Model->>View: Check activeView
  alt activeView != insufficientDimensionsView
    Model->>Msg: Decrement framesLeft
    Msg-->>Model: framesLeft == 0?
    alt framesLeft == 0
      Model->>Msg: Clear message.value
    end
  else
    Model->>Msg: Skip countdown and clearing
  end
  Model-->>Timer: Updated model
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lower-min-terminal-width-needed

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between a29a5ce and 8f5270c.

⛔ Files ignored due to path filters (2)
  • internal/ui/__snapshots__/TestInsufficientDimensionsView_1.snap is excluded by !**/*.snap
  • internal/ui/__snapshots__/TestTerminalWidthResizingWorks_1.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • internal/ui/update.go (1 hunks)
  • internal/ui/view.go (2 hunks)
  • internal/ui/view_test.go (2 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[grammar] ~17-~17: There might be a mistake here.
Context: ...e range limit for stats and log commands - Missing end date in date range implies t...

(QB_NEW_EN_OTHER)


[grammar] ~18-~18: There might be a mistake here.
Context: ...g end date in date range implies today (eg. 2025/08/12...) - "today" can be used in...

(QB_NEW_EN_OTHER)


[grammar] ~18-~18: There might be a mistake here.
Context: ... range implies today (eg. 2025/08/12...) - "today" can be used in date range (eg. 2...

(QB_NEW_EN_OTHER)


[grammar] ~19-~19: There might be a mistake here.
Context: ...g. 2025/08/12...) - "today" can be used in date range (eg. 2025/08/12...today) - I...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ....) - "today" can be used in date range (eg. 2025/08/12...today) - Improved TUI navi...

(QB_NEW_EN_OTHER)


[grammar] ~19-~19: There might be a mistake here.
Context: ...d in date range (eg. 2025/08/12...today) - Improved TUI navigation: esc/q now funct...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: Use correct spacing
Context: ...nction in more panes, returning the user to previous panes in a predictable manne...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[style] ~21-~21: Consider replacing this phrase with the adverb “predictably” to avoid wordiness.
Context: ...eturning the user to previous panes in a predictable manner - User messages in the TUI remain visib...

(IN_A_X_MANNER)


[grammar] ~21-~21: There might be a mistake here.
Context: ...o previous panes in a predictable manner - User messages in the TUI remain visible ...

(QB_NEW_EN_OTHER)


[style] ~23-~23: The double modal “needed brought” is nonstandard (only accepted in certain dialects). Consider “to be brought”.
Context: ...a while - Minimum terminal width needed brought down to 80 characters (from 96) ## [v0...

(NEEDS_FIXED)


[grammar] ~23-~23: There might be a mistake here.
Context: ... brought down to 80 characters (from 96) ## [v0.5.0] - Feb 22, 2025 ### Added - Sup...

(QB_NEW_EN_OTHER)

🔇 Additional comments (2)
internal/ui/update.go (1)

44-51: Good guard: freeze message countdown while in insufficient dimensions view.

This prevents the status message timer from expiring while the overlay is active. The placement is correct and doesn’t affect other views.

internal/ui/view.go (1)

17-17: Lowering minWidthNeeded to 80 is reasonable.

Brings the TUI within a more common 80-column terminal without impacting other layout constants here.


msg := tea.WindowSizeMsg{
Width: minWidthNeeded,
Width: 96,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Explain the magic number or extract a constant.

Since 96 is now intentionally larger than minWidthNeeded to keep existing snapshots stable, add a short comment to avoid confusion for future readers.

-        Width:  96,
+        // Use a width larger than minWidthNeeded to keep most snapshots stable.
+        Width:  96,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Width: 96,
// Use a width larger than minWidthNeeded to keep most snapshots stable.
Width: 96,
🤖 Prompt for AI Agents
In internal/ui/view_test.go around line 443, the literal Width: 96 is a magic
number; replace the literal with a named constant (e.g., stableSnapshotWidth =
96) and add a short comment on the constant explaining that 96 is intentionally
larger than minWidthNeeded to keep existing snapshots stable (mention
minWidthNeeded by name), then use that constant in the test so future readers
understand why the value is larger than the minimum.

@dhth dhth merged commit d454e68 into main Aug 18, 2025
15 checks passed
@dhth dhth deleted the lower-min-terminal-width-needed branch August 18, 2025 15:08
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.

1 participant