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

Tabs are not properly aligned in TextBox #15428

Open
mgarstenauer opened this issue Apr 18, 2024 · 2 comments
Open

Tabs are not properly aligned in TextBox #15428

mgarstenauer opened this issue Apr 18, 2024 · 2 comments
Labels
enhancement help-wanted A contribution from the community would be most welcome.

Comments

@mgarstenauer
Copy link
Contributor

Describe the bug

@ajkfds discovered that tabs (\t used for indentation) don't properly line up in AvaloniaEdit. See AvaloniaUI/AvaloniaEdit#412.

This seems to be a text formatting bug in Avalonia. It can be reproduced using a simple TextBox.

To Reproduce

Create a new Avalonia window with the following content:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        x:Class="AvaloniaApplication1.MainWindow"
        Title="AvaloniaApplication1" Height="200" Width="300">
    <Grid>
        <TextBox Text="&#x09;a&#x09;a&#x0D;a&#x09;a&#x09;a"/>
    </Grid>
</Window>

Note: The TextBox content is "\ta\ta\na\ta\ta"

This creates the following output in Avalonia:
image

The 'a' don't line up correctly.

Expected behavior

The 'a' are expected to be aligned. Here is the same window in WPF:

image

Avalonia version

11.0.6

OS

Windows

Additional context

No response

@mgarstenauer mgarstenauer changed the title Tab stops are not properly aligned Tab are not properly aligned Apr 18, 2024
@mgarstenauer mgarstenauer changed the title Tab are not properly aligned Tabs are not properly aligned in TextBox Apr 18, 2024
@Gillibald
Copy link
Contributor

Avalonia only supports fixed-width tabs and does no column layout calculation. There is no bug. This is just a feature that isn't available yet.

@Gillibald Gillibald added enhancement help-wanted A contribution from the community would be most welcome. and removed bug labels Apr 18, 2024
@workgroupengineering
Copy link
Contributor

Hi @Gillibald, I would like to work on this feature because I needed it, but I need help designing it.

Initially I was considering adding a FixedTabWidth attached property to TextElement, but I would like to leave the door open for advanced tabs manager like Microsoft Word and Libreoffice Write do. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help-wanted A contribution from the community would be most welcome.
Projects
None yet
Development

No branches or pull requests

3 participants