dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

[Windows] Editor: Text selection glitchy on subsequent lines #25950

Open formerlymisterhenson opened 2 days ago

formerlymisterhenson commented 2 days ago

Description

In the MAUI Editor component on Windows, a glitch occurs with text selection. While the first line of text behaves as expected, subsequent lines exhibit an issue where parts of the text remain highlighted, even after the selection is cleared.

Steps to Reproduce

https://github.com/user-attachments/assets/fc186e36-ea7d-4a93-9918-4f5083d82a43

Link to public reproduction project repository

No response

Version with bug

9.0.0 GA

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.0-rc.2.24503.2

Affected platforms

Windows

Affected platform versions

Windows 10

Did you find any workaround?

No response

Relevant log output

kevinxufei commented 1 day ago

I can repro this issue at Windows platform on the latest 17.13 Preview 1(9.0.0), but it works fine on 9.0.0-rc.2.24503.2 & 8.0.3. Sample project: https://github.com/rachelkang/recipeSearch.git Image

formerlymisterhenson commented 1 hour ago

Well for others dealing with the same problem, I found a workaround:

#if WINDOWS
        Microsoft.Maui.Handlers.EditorHandler.Mapper.AppendToMapping("SelectionChanged", (handler, view) =>
        {
            handler.PlatformView.SelectionChanged += 
            new Microsoft.UI.Xaml.RoutedEventHandler((object sender, Microsoft.UI.Xaml.RoutedEventArgs e) =>
            {
                handler.PlatformView.UpdateBackground(view);
            });
        });
#endif