Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiffView control compare chinese text line is not good enough #137

Open
hjy1210 opened this issue Jul 24, 2024 · 1 comment
Open

DiffView control compare chinese text line is not good enough #137

hjy1210 opened this issue Jul 24, 2024 · 1 comment

Comments

@hjy1210
Copy link

hjy1210 commented Jul 24, 2024

In chinese text context, each character is a word, there is no space between words.

One expect difference between "台灣好" and "臺灣好" is only the first character "台" against "臺".

In my simple project, I got

DiffPlex

My code:
MainWindow.xaml

<Window x:Class="WpfAppDiffPlex.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:diffplex="clr-namespace:DiffPlex.Wpf.Controls;assembly=DiffPlex.Wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid >
        <diffplex:DiffViewer x:Name="DiffView" FontSize="24"/>
    </Grid>
</Window>

MainWindow.xaml.cs

using System.Windows;

namespace WpfAppDiffPlex
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DiffView.OldText = "台灣好\n台 灣好\nTaiwan good";
            DiffView.NewText = "臺灣好\n臺 灣好\nTainan good";
        }
    }
}

How can I fix this problem? Thanks

@hjy1210
Copy link
Author

hjy1210 commented Nov 4, 2024

If I change the DelimiterChunk.cs, I can fix the problem.

But this way it will affect other users.

Is there is a way to custom DiffView to use my customed DelimiterChunk.cs?

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

No branches or pull requests

1 participant