Skip to content

Relocate enveditor's DS2-only textarea.go additions to textarea_ds2.go - #156

Merged
CLHatch merged 1 commit into
mainfrom
refactor/enveditor-textarea-relocate-additions
Aug 22, 2026
Merged

Relocate enveditor's DS2-only textarea.go additions to textarea_ds2.go#156
CLHatch merged 1 commit into
mainfrom
refactor/enveditor-textarea-relocate-additions

Conversation

@CLHatch

@CLHatch CLHatch commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Step 1 of scoping the bubbles textarea/selection port and the .env/YAML syntax-mode extraction discussed separately -- pure file reorganization, no behavior change.

  • Compared function names between DS2's enveditor/textarea.go and upstream charm.land/bubbles/v2@v2.2.0's textarea/textarea.go: 92 vs 95, with 81 shared names (DS2's fork is still structurally close to upstream).
  • Moved the 10 functions that were pure DS2 additions (never modifications of existing upstream code) to textarea_ds2.go, matching that file's own stated purpose (see its header comment): TotalDisplayLines, ResetCurrentVariable, LineMetaAt, YOffset, VisualRowToLogical, blinkTick (+ blinkTickMsg/blinkTickInterval), and the four line-number-gutter StyleState methods.
  • textarea.go's function set now matches upstream's by name with exactly one exception: insertRunes, corresponding to upstream's insertRunesFromUserInput but with DS2's .env line-classification logic spliced into its body. That one needs the classification logic extracted behind a hook before it can move -- not a plain relocation, tracked as a separate follow-up.

Test plan

  • go build ./..., GOOS=linux go build ./..., go vet ./..., go test ./... all pass
  • Pure code motion -- no logic changed, verified via comm diff of before/after function name sets against upstream

Summary by Sourcery

Enhancements:

  • Relocate DS2-specific textarea functionality into textarea_ds2.go to align the base textarea implementation with upstream structure without changing behavior.

textarea.go is meant to stay closely aligned with upstream bubbles'
textarea for easier future syncs (see textarea_ds2.go's header comment).
Moved 10 functions that were pure DS2 additions -- never modifications of
upstream code -- to textarea_ds2.go: TotalDisplayLines,
ResetCurrentVariable, LineMetaAt, YOffset, VisualRowToLogical, blinkTick
(plus blinkTickMsg/blinkTickInterval), and the four line-number-gutter
StyleState methods.

textarea.go's function set now matches upstream bubbles v2.2.0's
textarea.go by name, with one exception: insertRunes, which corresponds
to upstream's insertRunesFromUserInput but has DS2's .env line
classification spliced into its body -- that one needs the classification
logic extracted behind a hook before it can move, not a plain relocation
(tracked separately).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

Relocates all DS2-specific textarea helpers from the shared textarea.go into textarea_ds2.go so that textarea.go’s exported/public API and helper set match upstream bubbles’ textarea implementation, without changing behavior.

File-Level Changes

Change Details Files
Move DS2-only StyleState line-number gutter computed-style helpers out of the shared textarea implementation into the DS2-specific extension file.
  • Removed computedLineNumberFocused, computedLineNumberModified, computedLineNumberModifiedFocused, and computedLineNumberBrackets from the core textarea implementation.
  • Reintroduced these four helpers in the DS2 extension file, preserving their bodies and comments but grouping them under a DS2-specific comment block.
internal/tui/components/enveditor/textarea.go
internal/tui/components/enveditor/textarea_ds2.go
Relocate DS2-specific cursor blinking scheduling and metadata helpers from textarea.go into textarea_ds2.go.
  • Moved blinkTickMsg type, blinkTickInterval constant, and blinkTick command helper from the core textarea file into the DS2 extension file.
  • Kept signatures and behavior identical to preserve existing cursor blink timing and messaging semantics.
internal/tui/components/enveditor/textarea.go
internal/tui/components/enveditor/textarea_ds2.go
Move DS2-only enveditor model helpers (display line counting, env var resetting, metadata and viewport helpers) into textarea_ds2.go to isolate DS2 extensions from upstream textarea.
  • Relocated TotalDisplayLines, ResetCurrentVariable, LineMetaAt, YOffset, and VisualRowToLogical from textarea.go to textarea_ds2.go without modification.
  • Ensured these helpers continue to operate on Model and its internal fields identically, maintaining behavior for env editor-specific features like default variable reset and logical/visual row mapping.
internal/tui/components/enveditor/textarea.go
internal/tui/components/enveditor/textarea_ds2.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@CLHatch
CLHatch merged commit b97e14a into main Aug 22, 2026
6 checks passed
@CLHatch
CLHatch deleted the refactor/enveditor-textarea-relocate-additions branch August 22, 2026 01:49
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.

1 participant