Menu ▾ ▴

#63 Expose page zoom in the Settings window

closed
nobody
None
2026-07-04
2026-07-03
Anonymous
No

Originally created by: kristofferR

What

Adds a Page zoom select to the Settings window's General tab and makes the Settings struct the source of truth for the zoom level, with two-way sync to the page. Ref [#55] (part of epic [#59]).

Why

Zoom already existed (Cmd/Ctrl +/-/0, 30–200% in 10% steps) but was invisible in Settings and persisted only in page-local localStorage — it wasn't even re-applied on page load.

How

  • Settings.zoom (integer percent, default 100) clamped to 30–200 on load, save, and event intake (Settings::sanitized / clamp_zoom).
  • Settings UI: a select with the same 10% steps as the keyboard zoom, following the existing theme/badge_mode selectRow pattern (extended with an optional parse arg so the numeric value round-trips through set_settings).
  • messenger.js applies __CARRIER_SETTINGS__.zoom at load and on every carrier:settings push; keyboard/View-menu zoom emits carrier:zoom via plugin:event|emit, which Rust persists without re-pushing settings (mirrors the carrier:unread handler) so the two directions can't feed back.
  • The remote-origin event payload is untrusted: parsed as an integer, clamped, junk ignored. The init-script localStorage merge clamps the cached zoom the same way.
  • Pre-existing installs migrate their old localStorage zoom once, when settings still hold the default.
  • README mentions the Settings control next to the zoom shortcut.

Verified

  • cargo fmt / cargo clippy --all-targets -- -D warnings clean; cargo test --lib 47 passed (includes new tests for the default, clamping, and missing-key deserialization).
  • node --check src-tauri/inject/messenger.js passes.

Notes

Sibling feature PRs from the same epic touch the same Settings struct / settings.html field arrays, so trivial merge conflicts with them are expected.

https://claude.ai/code/session_01Pqw8xaJrGLhgSo2YR68ov5

Summary by CodeRabbit

  • New Features
  • Added a new Page zoom option in Settings (General), with preset zoom levels and support for persisting custom values.
  • Page zoom now persists across restarts and stays synchronized while the app is running.
  • Bug Fixes
  • Automatically clamps and corrects invalid or out-of-range zoom values to a valid range.
  • Documentation
  • Updated the README to reflect the revised Settings window (F3) description and added a note that Page zoom (via Settings → Page zoom) persists across restarts.

Related

Tickets: #55
Tickets: #59

Discussion

  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    Review Change Stack

    No actionable comments were generated in the recent review. 🎉

    ℹ️ Recent review info
    ⚙️ Run configuration **Configuration used**: Path: .coderabbit.yaml **Review profile**: ASSERTIVE **Plan**: Pro **Run ID**: `f6ce1ac3-6543-447f-bce5-edb503c6c0c8`
    📥 Commits Reviewing files that changed from the base of the PR and between [67a34b] and 85e9420a021a7d8fd06f947f6838dd51cac6f10e.
    📒 Files selected for processing (2) * `src-tauri/inject/messenger.js` * `src-tauri/src/lib.rs`

    📝 Walkthrough ## Walkthrough Adds a persistent page zoom setting across the backend settings model, injected page script, settings UI, and README, with zoom values clamped and synchronized through settings changes and runtime events. ### Changes **Page Zoom Feature** |Layer / File(s)|Summary| |---|---| |**Settings struct, clamping, and persistence**
    `src-tauri/src/lib.rs`|Adds `zoom` to `Settings`, clamps it through load/store paths, initializes defaults, wires `carrier:zoom`, and extends tests for clamping and missing values.| |**Injected messenger zoom tracking and sync**
    `src-tauri/inject/messenger.js`|Tracks zoom in memory, updates page/localStorage/settings snapshots, and syncs with `window.__CARRIER_SETTINGS__` plus legacy stored values.| |**Settings UI zoom control**
    `dist/settings.html`|Adds a General tab zoom field, numeric parsing for select persistence, and a zoom dropdown row.| |**README documentation update**
    `README.md`|Updates the settings feature list and adds a note about zoom persistence across restarts.| **Estimated code review effort:** 3 (Moderate) | ~25 minutes ### Sequence Diagram(s) :::mermaid sequenceDiagram participant User participant SettingsUI participant Backend participant MessengerJS participant Disk User->>SettingsUI: choose page zoom SettingsUI->>Backend: persist zoom value Backend->>Disk: save sanitized settings Backend->>MessengerJS: carrier:settings event MessengerJS->>MessengerJS: syncZoomFromSettings() User->>MessengerJS: change zoom in page MessengerJS->>Backend: carrier:zoom event Backend->>Disk: save updated zoom **Possibly related issues** - [kristofferR/Carrier#55](https://github.com/kristofferR/Carrier/issues/55): Requests adding a zoom control under Settings and syncing it through `window.__CARRIER_SETTINGS__` / `carrier:settings`, which matches the page zoom feature in this PR.
    🚥 Pre-merge checks | ✅ 5
    ✅ Passed checks (5 passed) | Check name | Status | Explanation | | :------------------------: | :------- | :--------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title clearly describes the main change: adding page zoom to the Settings window. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
    ✨ Finishing Touches
    📝 Generate docstrings - [ ] Create stacked PR - [ ] Commit on current branch
    🧪 Generate unit tests (beta) - [ ] Create PR with unit tests - [ ] Commit unit tests in branch `feature/zoom-setting`
    ⚔️ Resolve merge conflicts - [ ] Resolve merge conflict in branch `feature/zoom-setting`

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

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-07-04

    Originally posted by: coderabbitai[bot]

    ✅ 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.
     
  • Anonymous

    Anonymous - 2026-07-04

    Ticket changed by: kristofferR

    • status: open --> closed
     

Log in to post a comment.