Skip to content

GO-7038 Strip trailing newlines when pasting over selection at end of…#3033

Merged
KirillSto merged 1 commit intodevelopfrom
go-7038-code-block-blank-line-paste-selection
Apr 21, 2026
Merged

GO-7038 Strip trailing newlines when pasting over selection at end of…#3033
KirillSto merged 1 commit intodevelopfrom
go-7038-code-block-blank-line-paste-selection

Conversation

@KirillSto
Copy link
Copy Markdown
Member

@KirillSto KirillSto commented Mar 20, 2026

Summary

  • Fix extra blank line appearing when pasting text over a selection that extends to the end of a code block
  • Clipboard content typically includes a trailing \n which, when there's no text after the selection to absorb it, creates blank lines that accumulate with each paste
  • Strip trailing newlines from paste text only when the selection reaches the end of the code block; mid-text pastes preserve trailing newlines as separators

Test plan

  • Unit tests pass (TestClipboard_PasteToCodeBlock_TrailingNewline — 3 subtests)
  • Existing TestClipboard_PasteToCodeBlock still passes (no regression)
  • Full clipboard test suite passes
  • Manual verification: paste over selection at end of code block, no extra blank line (QA is needed, as fix should be verified on Windows)

🤖 Generated with Claude Code

… code block

Clipboard content often includes a trailing \n which, when pasting at the
end of a code block, creates an extra blank line. This accumulates with
each paste operation. Fix by trimming trailing newlines from paste text
only when the selection extends to the end of the code block.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@KirillSto KirillSto self-assigned this Mar 20, 2026
@github-actions
Copy link
Copy Markdown

New Coverage 46.5% of statements
Patch Coverage 100.0% of changed statements (3/3)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

@KirillSto KirillSto marked this pull request as ready for review April 20, 2026 16:36
@KirillSto KirillSto requested a review from deff7 April 20, 2026 16:36
@KirillSto KirillSto merged commit 3962f59 into develop Apr 21, 2026
14 checks passed
@KirillSto KirillSto deleted the go-7038-code-block-blank-line-paste-selection branch April 21, 2026 15:18
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants