Skip to content

[codex] Fix packaged markdown text selection#88

Merged
nerocui merged 1 commit into
mainfrom
codex/fix-packaged-markdown-selection
May 22, 2026
Merged

[codex] Fix packaged markdown text selection#88
nerocui merged 1 commit into
mainfrom
codex/fix-packaged-markdown-selection

Conversation

@Xueyang-Song

Copy link
Copy Markdown
Collaborator

Summary

Fixes the packaged-build markdown/code-viewer selection crash and first-drag flash by keeping the preview renderer stable during queued view-model refreshes and hardening the markdown selection overlay lifecycle.

Root Cause

In packaged x86 builds, the first pointer interaction could trigger a queued preview refresh that replaced the markdown renderer while it owned pointer capture. That dropped capture mid-drag and, in the crash path, caused overlay children to be added during WinUI measure/arrange.

Changes

  • Reuse the existing file preview renderer when the preview kind is unchanged.
  • Pre-create and safely reattach the markdown selection adorner and drag shield.
  • Ignore touch contacts in markdown selection/hover handling so touch scroll remains owned by the containing ScrollViewer.
  • Require selection move/release/cancel events to match the active captured pointer.
  • Draw selected glyph foreground with a masked text layout pass instead of per-selection-rect clipped layers.

Validation

  • dotnet test MarkdownRenderer\MarkdownRenderer.Tests\MarkdownRenderer.Tests.csproj -c Release -p:Platform=x64 --no-restore
  • dotnet test JitHub.WinUI.Tests\JitHub.WinUI.Tests.csproj -c Release -p:Platform=x64
  • dotnet build JitHub.WinUI\JitHub.WinUI.csproj -c Release -p:Platform=x86 -p:GenerateAppxPackageOnBuild=false --no-restore
  • Registered and launched the x86 packaged-style build locally; user confirmed the crash/first-drag issue is fixed.

@nerocui nerocui marked this pull request as ready for review May 22, 2026 08:20
@nerocui nerocui merged commit 1010c15 into main May 22, 2026
1 check passed
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.

2 participants