Skip to content

tokenizeLineToHTML() misaligns tabs when startOffset > 0 #263386

@barroit

Description

@barroit

Type: Bug

When startOffset is non-zero, tabsCharDelta doesn't accumulate chars before charIndex, and the first <span> ends up short on padding in generated HTML.

This causes clipboardCopyWithSyntaxHighlightingAction command to return incorrect padding on the first line in its output if we start selection with text after the first column.

Source location:
src/vs/editor/common/languages/textToHtmlTokenizer.ts
Image

VS Code version: Code - OSS Dev 1.104.0 (Commit 0a565d1, Date Mon Aug 25 23:41:01 2025 -0700)
OS version: Linux x64 6.14.0-28-generic
Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i9-13900KF (32 x 5497)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 62.62GB (41.07GB free)
Process Argv . --disable-extension=vscode.vscode-api-tests --no-sandbox
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Extensions disabled

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions