Skip to content

Commit

Permalink
Increase minimum size of LineNumberMargin
Browse files Browse the repository at this point in the history
Increase the size of the LineNumberMargin to improve readability and
ensure that there is some space between the line numbers and the next
AbstractMargin.
  • Loading branch information
mgarstenauer committed May 31, 2024
1 parent bc68bed commit bbd2e65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/AvaloniaEdit.Demo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<TextBlock Foreground="White" Name="StatusText" Text="Ready" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12"/>
</StackPanel>
<AvalonEdit:TextEditor Name="Editor"
Margin="24,0,0,0"
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Visible"
Expand Down
6 changes: 3 additions & 3 deletions src/AvaloniaEdit/Editing/LineNumberMargin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ private void OnDocumentLineCountChanged()
var newLength = documentLineCount.ToString(CultureInfo.CurrentCulture).Length;

// The margin looks too small when there is only one digit, so always reserve space for
// at least two digits
if (newLength < 2)
newLength = 2;
// at least four digits
if (newLength < 4)
newLength = 4;

if (newLength != MaxLineNumberLength)
{
Expand Down

0 comments on commit bbd2e65

Please sign in to comment.