Skip to content

refactor: move inline double brushs stroke to helper#4194

Merged
grigoriy-reshetniak merged 1 commit intomainfrom
refactor-svg-double-stroke
Apr 5, 2026
Merged

refactor: move inline double brushs stroke to helper#4194
grigoriy-reshetniak merged 1 commit intomainfrom
refactor-svg-double-stroke

Conversation

@grigoriy-reshetniak
Copy link
Copy Markdown
Collaborator

It's inconvenient to write and support manual double brush strokes for SVG.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 5, 2026

Greptile Summary

This PR refactors svgGeometry.ts to introduce a doubleBrushStroke helper function that replaces manually duplicated SVG path strings, improving maintainability and reducing repetition. The comment explaining the double-brush-stroke anti-aliasing technique is also relocated from stretchy.ts to svgGeometry.ts where the paths are defined.

  • Introduces doubleBrushStroke(svgPath) — a one-liner helper that produces `${svgPath} ${svgPath}` — replacing ~14 manual duplications across innerPath() switch cases and the path data object in svgGeometry.ts
  • Moves the "Second Brush Stroke" explanation comment from stretchy.ts to svgGeometry.ts, co-locating it with the relevant code and the new helper
  • All refactored paths are functionally equivalent — the minor whitespace change (newline → space as separator between the two path copies) is semantically identical in SVG path data
  • Pre-existing paths that use a different doubling technique (relative m0 0 after z, e.g. leftharpoondownplus, rightharpoonplus) were correctly left unchanged, as they are not simple string duplications

Confidence Score: 5/5

This PR is safe to merge — it is a pure refactoring with no functional changes to SVG output.

The doubleBrushStroke helper correctly reproduces each original doubled path string. The only semantic difference is whitespace normalization (newline → space between the two copies), which is completely innocuous in SVG path data. All switch cases in innerPath() and all static entries in the path object have been accounted for and verified against the originals.

No files require special attention.

Important Files Changed

Filename Overview
src/svgGeometry.ts Introduces doubleBrushStroke helper and applies it to ~14 formerly hand-duplicated SVG path strings; functionally equivalent, cleaner code
src/stretchy.ts Removes the 'Second Brush Stroke' comment block (relocated to svgGeometry.ts); no logic changes

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SVG path string] --> B[doubleBrushStroke]
    B --> C[\"path path\"]
    C --> D[innerPath switch case]
    C --> E[path data object]
    D --> F[SVG renderer]
    E --> F
    style B fill:#d4edda,stroke:#28a745
Loading

Reviews (1): Last reviewed commit: "refactor: move inline double brushs stro..." | Re-trigger Greptile

@grigoriy-reshetniak grigoriy-reshetniak merged commit ed12205 into main Apr 5, 2026
9 checks passed
@grigoriy-reshetniak grigoriy-reshetniak deleted the refactor-svg-double-stroke branch April 5, 2026 13:21
@edemaine
Copy link
Copy Markdown
Member

edemaine commented Apr 5, 2026

🎉 This PR is included in version 0.16.45 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants