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

Remove margin around TextEditor #419

Merged

Conversation

mgarstenauer
Copy link
Contributor

This is a cosmetic PR that removes the 30px margin around the TextEditor in the demo.

Before:
image

After:
image

(Looking at the git history, the Margin has been there for the last 7+ years. I don't think that the margin serves any purpose. Let's remove it to avoid any confusion!)

@Rekkonnect
Copy link

Most code editors have a margin on the line number panel to make it more readable and prettier. Removing the margin feels much worse to me.

@mgarstenauer
Copy link
Contributor Author

@Rekkonnect Thanks for the feedback. I was mainly worried about the margins on the other sides. Having space between the scrollbars and the window, felt like a bug.

I pushed a small change. Keep some margin on the left for readability, remove the top/right/bottom margins. Here is what it looks like:

image

@mgarstenauer mgarstenauer force-pushed the remove-margin-around-texteditor branch from 35b1b41 to bbd2e65 Compare May 31, 2024 14:01
@mgarstenauer
Copy link
Contributor Author

mgarstenauer commented May 31, 2024

I increased the minimum size of the LineNumberMargin. This ensures that there is enough space between the line numbers and any other text editor margins.

Together with the breakpoint margin it looks like this:
image

Increase the size of the LineNumberMargin to improve readability and
ensure that there is some space between the line numbers and the next
AbstractMargin.
@mgarstenauer mgarstenauer force-pushed the remove-margin-around-texteditor branch from bbd2e65 to 9c14ce0 Compare November 21, 2024 09:10
@mgarstenauer
Copy link
Contributor Author

I have added a property LineNumberMargin.MinWidthInDigits. The width of the LineNumberMargin is now styleable from XAML. Example:

<AvalonEdit:TextEditor.Styles>
  <Style Selector="editing|LineNumberMargin">
    <Setter Property="MinWidthInDigits" Value="4" />
  </Style>
</AvalonEdit:TextEditor.Styles>

The defaults are as before to make sure that the changes in this PR don't mess up the layout of existing apps.

@maxkatz6 maxkatz6 merged commit 73382a7 into AvaloniaUI:master Dec 16, 2024
1 check passed
@mgarstenauer mgarstenauer deleted the remove-margin-around-texteditor branch December 17, 2024 09:41
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.

3 participants