Skip to content

Show or hide a workbook's sheet tabs and scroll bars (fixes #3101) - #3239

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
hectorviov:feat/workbook-display-options
Nov 3, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
hectorviov:feat/workbook-display-options

Conversation

@hectorviov

@hectorviov hectorviov commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3101

What

Excel can hide the sheet tabs, the horizontal scroll bar and the vertical scroll bar of a workbook window: File › Options › Advanced › Display options for this workbook. The choice is saved with the workbook. GridCraft already reads and writes these settings (<workbookView showSheetTabs … />, #3057), but it always showed all three and had no command or option for them.

  • Commands (crates/engine/src/cmd/view.rs): view.showSheetTabs, view.showHorizontalScrollBar and view.showVerticalScrollBar, each {on?}. They toggle without on, like view.gridlines, are undoable, and are saved with the workbook. So the CLI, MCP and the control channel reach them.
  • Tab bar (crates/ui-egui/src/tabs.rs):
    • Sheet tabs off: the navigation buttons, tabs and New sheet button go, and the horizontal scroll bar takes the whole bar.
    • Horizontal scroll bar off: the tabs take the bar and there's no split handle.
    • Both off: the bar isn't shown.
  • Grid (crates/ui-egui/src/grid/show.rs): with the vertical scroll bar off, the grid takes its width.
  • File › Options: a "Display options for this workbook" section with the three check boxes, which run the commands.

Comparison

GridCraft main (178f3eb) GridCraft with this PR Excel
view.showSheetTabs {on: false} unknown command tabs hidden, scroll bar spans the bar (screenshot below) Show sheet tabs off: no tabs
view.showVerticalScrollBar {on: false} unknown command no vertical scroll bar, grid full width Show vertical scroll bar off
both horizontal and tabs off — no tab bar no bar
saved and reopened settings already kept (#3057), never applied kept and applied kept
File › Options no such section "Display options for this workbook" with three check boxes Advanced › Display options for this workbook

Excel's behaviour is the issue's measurement (COM, in #3057). I didn't change these options in Excel myself, since they're Excel settings on the machine.

Fix build with Show sheet tabs and Show vertical scroll bar off: no tabs, the horizontal scroll bar across the bar, no vertical scroll bar, and the grid at full width.

Tests

  • tests::workbook_display_options_are_commands (engine): toggle and explicit on, saved through XLSX, undo.
  • tab_split::display_options_hide_the_sheet_tabs_and_the_horizontal_scroll_bar (ui-egui): tabs off (no tab names, no split handle, scroll bar from the left), scroll bar off (tabs shown, no track or handle), both off (no bar). It fails on main's tab bar.
  • cargo xtask ci passes.

Anything a reviewer should look at first

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added workbook-specific options to show or hide sheet tabs and horizontal and vertical scroll bars. Changes are saved with the workbook and can be set directly or toggled.
    • When sheet tabs are hidden, the horizontal scroll bar can use the available space; when the horizontal scroll bar is hidden, tabs can use it. Hiding both removes the bottom bar and its controls.
    • Hiding the vertical scroll bar gives its space back to the worksheet grid.

…book

Excel can hide the sheet tabs, the horizontal scroll bar and the
vertical scroll bar of a workbook window (File › Options › Advanced ›
Display options for this workbook), saved with the workbook. GridCraft
already read and wrote these settings (storytold#3057) but always showed all
three, and had no command or option for them.

New commands view.showSheetTabs, view.showHorizontalScrollBar and
view.showVerticalScrollBar {on?} (toggling without `on`, undoable,
saved with the workbook), and a "Display options for this workbook"
section in File › Options. The tab bar follows them: without the tabs
the scroll bar takes the bar, without the scroll bar the tabs do, and
with neither the bar isn't shown; without the vertical scroll bar the
grid takes its width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

Adds workbook commands and Options page controls for sheet-tab and scroll-bar visibility. The UI adjusts tab-bar and grid rendering to reflect these settings. Tests cover command state, XLSX persistence, undo, and tab-bar visibility combinations.

Changes: Workbook Display Options

Layer / File(s) Summary
Display-option commands
crates/engine/src/cmd/view.rs, crates/engine/src/tests.rs
Adds commands to set or toggle sheet-tab and horizontal and vertical scroll-bar visibility. Tests check command results, stored state, XLSX round-trip persistence, and undo.
Options page controls
crates/ui-egui/src/backstage/options.rs, docs/ui-parity.md
The Options page displays workbook settings and sends the matching command when a checkbox changes. The parity notes describe the settings and their effect on available bar space.
Tab bar and grid visibility
crates/ui-egui/src/tabs.rs, crates/ui-egui/src/grid/show.rs, crates/ui-egui/tests/it/tab_split.rs
The tab bar and grid adjust rendering and available space based on visibility settings. UI tests check visibility combinations and cached control rectangles.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant OptionsPage
  participant ViewCommand
  participant WorkbookViewSettings
  participant WorkbookUI
  User->>OptionsPage: Change a display checkbox
  OptionsPage->>ViewCommand: Send visibility command
  ViewCommand->>WorkbookViewSettings: Set the selected visibility flag
  WorkbookUI->>WorkbookViewSettings: Read visibility settings
  WorkbookUI-->>User: Render tabs and scroll bars accordingly
Loading

Possibly related issues

  • storytold/gridcraft#3057 — The changes test XLSX persistence for visibility settings. The issue also tracks tab-ratio persistence, which this pull request does not cover.
  • storytold/gridcraft#775 — The changes preserve sheet-tab and scroll-bar display settings during XLSX round trips.

Suggested reviewers: aiongg, dotcoocoo

Merge Risk: Minimal · up to fe6ab

The requested workbook display controls are wired through commands, saved correctly, and applied consistently in the UI. No merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning For #3101, the PR implements the three workbook display commands, File › Options checkboxes, workbook persistence for those flags, tab-bar and grid behavior, and automated tests. The linked issue also… Persist the dragged tab split share in the workbook tab_ratio/tabRatio view setting. Restore it when the workbook opens, update it when the split handle moves, and add an automated round-trip test.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding workbook-scoped controls for sheet tabs and scroll bars. The issue reference is relevant and does not obscure the title.
Out of Scope Changes check Passed The changed engine, UI, integration-test, and parity-documentation files support the #3101 commands, workbook options, display behavior, validation, or documented parity. No demonstrated unrelated fun…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Out of Scope Changes check

Explanation

The changed engine, UI, integration-test, and parity-documentation files support the #3101 commands, workbook options, display behavior, validation, or documented parity. No demonstrated unrelated functional change is present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 6 files.

Full details: Linked Issues check

Explanation

For #3101, the PR implements the three workbook display commands, File › Options checkboxes, workbook persistence for those flags, tab-bar and grid behavior, and automated tests. The linked issue also requires the dragged tab split share to be stored in the workbook. crates/ui-egui/src/tabs.rs still writes the share to app.grid.tab_shares, which is UI state. The PR does not persist or restore this share through the workbook view.

Resolution

Persist the dragged tab split share in the workbook tab_ratio/tabRatio view setting. Restore it when the workbook opens, update it when the split handle moves, and add an automated round-trip test.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 846cc09 and fe6ab7c.

Files selected for processing: 2
  • crates/ui-egui/src/tabs.rs
  • crates/ui-egui/tests/it/tab_split.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@hectorviov

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread crates/ui-egui/src/tabs.rs Resolved
…is hidden

Addresses review comment 4453674677: after a frame drew both controls,
turning off the horizontal scroll bar or the sheet tabs left
app.grid.hscroll / app.grid.tab_split holding the old rectangles.
sheet_tabs now clears both before any visibility return.

Test: tab_split::hiding_the_controls_clears_their_cached_rectangles
toggles both options on one live harness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 0081e4f into storytold:main Nov 3, 2026
1 check passed
h-a-n-a-s-h-i pushed a commit that referenced this pull request Nov 3, 2026
- #3223: sniff the first 64 KiB for a web page and skip JSON and files over the text-import cap, so
  every CSV/TSV is no longer decoded in full before the size check.
- #3253: SYLK relative offsets use checked arithmetic (no overflow on R[9223372036854775807]); at
  most 1024 column-width records are kept; regression test.
- #3254: a single selected merged cell searches the whole sheet, as one selected cell does.
- #3252: the formula bar's height cap is half the room below the ribbon, not half the window, so
  the worksheet stays visible in a short window (CodeRabbit Major).
- #3239, #3244, #3252, #3268: es/de/cs/zh/ko/ru/pt entries for the new interface strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon

echelon commented Nov 3, 2026

Copy link
Copy Markdown
Member

Merged — thank you @hectorviov for the contribution!

I added es/de/cs/zh/ko/ru/pt entries for the new Options strings on main (865a789).

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.

File › Options has no Show sheet tabs or Show scroll bar settings, and no command sets them

3 participants