Skip to content

feat(editor): add configurable horizontal scroll margin to CodeMirror - #2569

Merged
bajrangCoder merged 3 commits into
mainfrom
codemirror-horizontal-scroll-margin
Aug 2, 2026
Merged

feat(editor): add configurable horizontal scroll margin to CodeMirror#2569
bajrangCoder merged 3 commits into
mainfrom
codemirror-horizontal-scroll-margin

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

Summary

  • add horizontal scroll-past-end space for CodeMirror when word wrap is disabled
  • restore the existing editor margin behavior previously available with Ace
  • expose the margin under Editor settings → Scroll settings
  • update the horizontal scrollbar to use CodeMirror’s actual padded scroll width
  • add localized labels and unit coverage

Closes: #2398 #2277

@github-actions github-actions Bot added the translations Anything related to Translations Whether a Issue or PR label Aug 2, 2026
@bajrangCoder bajrangCoder linked an issue Aug 2, 2026 that may be closed by this pull request
1 task
@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a configurable horizontal scroll margin for unwrapped CodeMirror editors.

  • Applies the configured margin as right-side content padding and reconfigures open editor panes when the setting changes.
  • Exposes a validated whole-pixel input under scroll settings.
  • Updates scrollbar width calculation to use CodeMirror’s padded scroll width.
  • Adds language keys and unit coverage for margin normalization and theme generation.

Confidence Score: 4/5

The PR appears safe to merge, with the non-blocking caveat that the new setting remains untranslated in every non-English locale.

The editor setting, compartment reconfiguration, and scrollbar integration are coherently wired; the only accepted issue is duplicated English UI copy in localized language bundles.

Files Needing Attention: src/lang/*.json

Important Files Changed

Filename Overview
src/cm/scrollPastEnd.ts Adds a bounded horizontal-margin theme for unwrapped CodeMirror content.
src/lib/editorManager.js Integrates the horizontal margin with the wrap compartment, live setting updates, and native scroll-width measurement.
src/settings/scrollSettings.js Adds a non-negative whole-pixel margin input and stores its value numerically.
tests/unit/scrollPastEnd.test.js Covers theme generation, zero and invalid input handling, and fractional-value rounding.
src/lang/ar-ye.json Adds the required keys but leaves their values in English, as do the other changed non-English locale bundles.
bun.lock Records the Vitest dependency graph used by the new unit test setup.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Settings[Scroll settings: leftMargin] --> Store[appSettings.update]
    Store --> Event[update:leftMargin]
    Event --> Options[applyOptions textWrap]
    Options --> Wrap{Word wrap enabled?}
    Wrap -->|Yes| LineWrap[EditorView.lineWrapping]
    Wrap -->|No| Margin[horizontalScrollPastEnd]
    Margin --> Padding[Right padding on cm-content]
    Padding --> Width[scrollDOM.scrollWidth]
    Width --> Scrollbar[Horizontal scrollbar range]
Loading

Reviews (1): Last reviewed commit: "." | Re-trigger Greptile

Comment thread src/lang/ar-ye.json
@bajrangCoder
bajrangCoder added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit d2bd3a1 Aug 2, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Aug 2, 2026
@bajrangCoder
bajrangCoder deleted the codemirror-horizontal-scroll-margin branch August 2, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Scroll-X past end Add Editor "right margin" option to set the right-padding

1 participant