Skip to content

feat: enhance TerminalLayout with preview actions and overflow handling#1862

Merged
jarvishappy merged 1 commit intochaterm:mainfrom
dsd2077:main
Mar 23, 2026
Merged

feat: enhance TerminalLayout with preview actions and overflow handling#1862
jarvishappy merged 1 commit intochaterm:mainfrom
dsd2077:main

Conversation

@dsd2077
Copy link
Contributor

@dsd2077 dsd2077 commented Mar 23, 2026

Related Issue

Resolves #(issue_number)

Description

Checklist

  • I have read CONTRIBUTING and linked the related issue above if any.
  • npm run lint && npm run format && npm run typecheck && npm test all pass; tests added/updated as needed.
  • If UI or user-visible change: i18n and README updated.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where preview actions could overlap header tabs when displaying multiple tabs. Additional spacing is now reserved to prevent overlap.
  • Style

    • Improved editor actions area sizing with fixed dimensions to ensure consistent layout behavior.
  • Tests

    • Added test coverage to verify preview actions visibility and CSS styling behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

The pull request adds a reactive preview actions visibility flag to TerminalLayout.vue, computed from the active dock panel's parameters. It applies conditional CSS padding to reserve space for preview actions, updates the Dockview component configuration, and introduces test assertions to verify the implementation's presence.

Changes

Cohort / File(s) Summary
Preview Actions Visibility Logic
src/renderer/src/views/layouts/TerminalLayout.vue
Added reactive isPreviewActionsVisible flag derived from active dock panel params (KnowledgeCenterEditor content, non-preview mode, markdown support). Updated on dock initialization and active panel changes. Bound .main-terminal-area to conditionally apply has-preview-actions CSS class. Added disable-tabs-overflow-list="true" prop to Dockview. Implemented LESS styling with 30px right padding for both light and dark themes when preview actions are visible.
Test Verification
src/renderer/src/views/layouts/__tests__/TerminalLayout.test.ts
Added filesystem-based test assertions that verify the presence of specific strings in source files: disable-tabs-overflow-list, padding-right: 30px, width: 30px, min-width: 30px, has-preview-actions, and computePreviewActionsVisible.
Editor Actions Styling
src/renderer/src/views/layouts/components/EditorActions.vue
Enforced fixed 30px width for .editor-actions container with width, min-width, flex, flex-shrink, and box-sizing properties. Set .action-item to prevent shrinking, ensuring consistent icon sizing within flex layouts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through layouts neat,
With actions placed in preview seat,
Thirty pixels, left and right,
Proper spacing, oh what sight!
No overflow shall steal the view,
Preview actions shining through! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description uses the repository template but provides only placeholders; the Description section is empty and no related issue is linked despite the PR implementing feature changes. Fill the Description section with details explaining what preview actions do, why overflow handling is needed, and link the related issue number in the 'Resolves' line.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: adding preview actions visibility toggle and CSS-based overflow handling to TerminalLayout component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@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: 1

🧹 Nitpick comments (2)
src/renderer/src/views/layouts/components/EditorActions.vue (1)

93-97: Redundant flex properties on absolutely-positioned element.

Based on context snippet 3, this component is rendered with the .dockview-actions-overlay class which uses position: absolute. Flex properties (flex: 0 0 30px, flex-shrink: 0) have no effect on absolutely-positioned elements—only width and min-width matter here.

Additionally, there's a sizing concern: with box-sizing: border-box, the 30px width minus 16px padding (8px each side) leaves only 14px for content, but .action-item requires 24px width (line 108).

Proposed fix: remove ineffective properties and fix padding
 .editor-actions {
   display: flex;
   align-items: center;
-  padding: 0 8px;
+  padding: 0 3px;
   width: 30px;
   min-width: 30px;
-  flex: 0 0 30px;
-  flex-shrink: 0;
   box-sizing: border-box;
   height: 35px; /* Match tab height */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/src/views/layouts/components/EditorActions.vue` around lines 93
- 97, Remove the ineffective flex rules from the absolutely-positioned overlay
(delete "flex: 0 0 30px" and "flex-shrink: 0" in the EditorActions.vue style for
.dockview-actions-overlay), and update sizing so .action-item can fit: with
box-sizing: border-box and 8px padding each side, increase width/min-width from
30px to 40px (or otherwise ensure width >= 24px + total horizontal padding) to
guarantee the .action-item 24px content fits. Reference
.dockview-actions-overlay and .action-item when making these edits.
src/renderer/src/views/layouts/__tests__/TerminalLayout.test.ts (1)

444-472: These string-based tests don't verify actual behavior and are fragile to refactoring.

The tests only check that literal strings exist in source files (e.g., 'has-preview-actions', 'computePreviewActionsVisible'), which:

  • Don't verify the CSS/logic actually works or applies correctly
  • Break on any refactor that changes variable/class names without functional change
  • Aren't aligned with the codebase's testing approach

Given the test patterns elsewhere in this file (logic extraction with mocked objects), consider refactoring these as behavioral tests. For example, extract the computePreviewActionsVisible logic and test it with mock panel states, then verify the visibility state toggles correctly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/src/views/layouts/__tests__/TerminalLayout.test.ts` around lines
444 - 472, Replace the brittle string-existence checks with behavioral tests:
locate and import (or extract) the computePreviewActionsVisible function from
TerminalLayout.vue (or its composition logic) and write unit tests that feed
mocked panel/editor states to computePreviewActionsVisible to assert true/false
outcomes; then mount TerminalLayout (or a small wrapper) with a mocked
store/props to assert the DOM/class behavior (presence of has-preview-actions
class and padding-right style) and mount EditorActions to assert its container
applies width/min-width 30px when preview actions are visible—use these function
names (computePreviewActionsVisible, has-preview-actions, EditorActions) and
mocked panel states instead of string file-content assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/renderer/src/views/layouts/TerminalLayout.vue`:
- Line 222: Remove the invalid prop disable-tabs-overflow-list from the
DockviewVue usage and instead pass the scrollbars option (e.g. via the
DockviewVue :options prop) or set it per-group via the API; update the component
where disable-tabs-overflow-list is used to use DockviewVue's :options with
scrollbars: 'native' or call event.api.addGroup({ id: 'groupId', scrollbars:
'native' }) when creating groups so tabs overflow is handled by the supported
scrollbars option.

---

Nitpick comments:
In `@src/renderer/src/views/layouts/__tests__/TerminalLayout.test.ts`:
- Around line 444-472: Replace the brittle string-existence checks with
behavioral tests: locate and import (or extract) the
computePreviewActionsVisible function from TerminalLayout.vue (or its
composition logic) and write unit tests that feed mocked panel/editor states to
computePreviewActionsVisible to assert true/false outcomes; then mount
TerminalLayout (or a small wrapper) with a mocked store/props to assert the
DOM/class behavior (presence of has-preview-actions class and padding-right
style) and mount EditorActions to assert its container applies width/min-width
30px when preview actions are visible—use these function names
(computePreviewActionsVisible, has-preview-actions, EditorActions) and mocked
panel states instead of string file-content assertions.

In `@src/renderer/src/views/layouts/components/EditorActions.vue`:
- Around line 93-97: Remove the ineffective flex rules from the
absolutely-positioned overlay (delete "flex: 0 0 30px" and "flex-shrink: 0" in
the EditorActions.vue style for .dockview-actions-overlay), and update sizing so
.action-item can fit: with box-sizing: border-box and 8px padding each side,
increase width/min-width from 30px to 40px (or otherwise ensure width >= 24px +
total horizontal padding) to guarantee the .action-item 24px content fits.
Reference .dockview-actions-overlay and .action-item when making these edits.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 59f5219c-9172-44f7-aff2-5272d60fda5e

📥 Commits

Reviewing files that changed from the base of the PR and between b2db229 and 9344e4f.

📒 Files selected for processing (3)
  • src/renderer/src/views/layouts/TerminalLayout.vue
  • src/renderer/src/views/layouts/__tests__/TerminalLayout.test.ts
  • src/renderer/src/views/layouts/components/EditorActions.vue

v-if="configLoaded"
ref="dockviewRef"
:class="currentTheme === 'light' ? 'dockview-theme-light' : 'dockview-theme-dark'"
:disable-tabs-overflow-list="true"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

dockview-vue disable-tabs-overflow-list prop

💡 Result:

No, there is no "disable-tabs-overflow-list" prop in dockview-vue. Official documentation at dockview.dev does not list this prop in DockviewVue options or IDockviewVueProps. Tab overflow behavior (dropdown/scroller when tabs exceed width) is handled internally by the library, with mentions in GitHub issues (#1062, #506) but no documented prop to disable the overflow list/dropdown. Customization is possible via custom tab renderers or CSS, but no direct boolean prop exists. Latest version is v5.1.0 (2026-03-02).

Citations:


🏁 Script executed:

# Check if the file exists and locate the line with disable-tabs-overflow-list
cd src/renderer/src/views/layouts && grep -n "disable-tabs-overflow-list" TerminalLayout.vue

Repository: chaterm/Chaterm

Length of output: 125


🏁 Script executed:

# Read the context around line 222 to understand the component structure
sed -n '210,235p' src/renderer/src/views/layouts/TerminalLayout.vue

Repository: chaterm/Chaterm

Length of output: 1284


🏁 Script executed:

# Check the package.json to verify the dockview-vue version used
cat package.json | grep -A 2 -B 2 "dockview-vue"

Repository: chaterm/Chaterm

Length of output: 198


🌐 Web query:

dockview-vue v4.11.0 disable-tabs-overflow-list prop tabs overflow

💡 Result:

No evidence found of a prop named "disable-tabs-overflow-list" in dockview-vue v4.11.0 or any version. For handling tabs overflow in Dockview (including dockview-vue), use the scrollbars={"native"} option introduced in v4.2.0 to enable native browser scrollbars on tab headers instead of the custom JS scrollbar. This was added to address issues with custom scrolling behavior, such as touchpad scrolling conflicts and drag-and-drop problems when tabs overflow. To apply it, pass it in the Dockview options or group options via the API: In DockviewVue props or onReady event: event.api.addGroup({ id: 'myGroup', scrollbars: 'native' // or { header: 'native' } if structured that way }); or globally: This uses native scrolling, which may prevent or alter the overflow list/dropdown behavior for hidden tabs (mentioned in v4.0.0 release notes: hidden tabs accessible via dropdown). Custom overflow popover can be rendered by consumers (issue #1062). No direct disable prop confirmed; use native scrollbars or custom tab rendering/CSS to manage overflow. v4.11.0 exists per releases and includes fixes post-v4.2.0.

Citations:


🏁 Script executed:

# Check if node_modules is available and if we can inspect the type definitions
if [ -d "node_modules/dockview-vue" ]; then
  echo "=== dockview-vue package found ===" 
  cat node_modules/dockview-vue/package.json | grep '"version"'
  
  # Search for the prop in type definitions or source
  find node_modules/dockview-vue -type f -name "*.d.ts" | head -5
  
  # Try to find any reference to disable-tabs-overflow-list
  grep -r "disable-tabs-overflow-list" node_modules/dockview-vue 2>/dev/null || echo "Prop not found in node_modules"
fi

Repository: chaterm/Chaterm

Length of output: 41


Remove the invalid disable-tabs-overflow-list prop and use the correct scrollbars option instead.

The disable-tabs-overflow-list prop does not exist in dockview-vue v4.11.0 (the version used in this project). To handle tabs overflow behavior, use the scrollbars option introduced in v4.2.0: either pass it to DockviewVue via :options="{ scrollbars: 'native' }" or apply it to specific groups through the API with event.api.addGroup({ id: 'groupId', scrollbars: 'native' }).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/src/views/layouts/TerminalLayout.vue` at line 222, Remove the
invalid prop disable-tabs-overflow-list from the DockviewVue usage and instead
pass the scrollbars option (e.g. via the DockviewVue :options prop) or set it
per-group via the API; update the component where disable-tabs-overflow-list is
used to use DockviewVue's :options with scrollbars: 'native' or call
event.api.addGroup({ id: 'groupId', scrollbars: 'native' }) when creating groups
so tabs overflow is handled by the supported scrollbars option.

@jarvishappy jarvishappy merged commit 6090bec into chaterm:main Mar 23, 2026
12 checks passed
@github-actions
Copy link

❤️ Great PR @dsd2077 ❤️

Thank you for your contribution to Chaterm! The growth of this project is inseparable from community feedback and contributions like yours.

We appreciate your time and effort in making Chaterm better! 🎉

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.

2 participants