Skip to content

fix: don't copy line numbers when copying a section of the log - #98

Merged
ozgesolidkey merged 1 commit into
mainfrom
fix/copy-section-no-line-numbers
Aug 13, 2026
Merged

ozgesolidkey merged 1 commit into
mainfrom
fix/copy-section-no-line-numbers

Conversation

@ozgesolidkey

Copy link
Copy Markdown
Contributor

Bug

Copying a selected section of the log included the gutter line numbers in the clipboard. user-select: none on .line-number stops the mouse from highlighting them but does not keep them out of getSelection().toString() (what "Copy Selection" uses), so they leaked in.

Fix

Render the line number as CSS-generated content instead of a real text node — each .line-number carries the value in a data-lineno attribute and shows it via .line-number::after { content: attr(data-lineno) }. Generated content is never part of a selection, so copying a section now yields the log text only, across every render path (main, virtualized, diff, DOM-built).

Uses ::after so it doesn't collide with the diff view's existing ::before +/-/~ gutter markers. Nothing reads the gutter's textContent, so no logic changes.

Verify

tsc 0 · 667 tests green · bundle built. GUI eyeball: line numbers still show correctly (incl. diff view markers), and selecting a section + copy → paste yields text with no line numbers.

🤖 Generated with Claude Code

Copying a selected section (via "Copy Selection" / getSelection().toString())
was including the gutter line numbers. `user-select: none` stops the mouse from
highlighting them but does NOT keep them out of Selection.toString(), so they
leaked into the clipboard.

Render the line number as CSS-generated content instead of a real text node:
each `.line-number` now carries the value in a `data-lineno` attribute and shows
it via `.line-number::after { content: attr(data-lineno) }`. Generated content
is never part of the selection, so copying a section yields the log text only —
no line numbers — across every render path (main, virtualized, diff, DOM-built).

Uses ::after so it doesn't collide with the diff view's ::before +/-/~ gutter
markers. Also added the -webkit-user-select prefix on the gutter. Nothing reads
the gutter's textContent, so no logic changes.

tsc 0 · 667 tests green · bundle built.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ozgesolidkey
ozgesolidkey merged commit 2799d4e into main Aug 13, 2026
3 checks passed
@ozgesolidkey
ozgesolidkey deleted the fix/copy-section-no-line-numbers branch August 13, 2026 12:38
ozgesolidkey added a commit that referenced this pull request Aug 19, 2026
fix: don't copy line numbers when copying a section of the log
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