Steps to reproduce
- Leave the default UI font size at
13 and set the code editor font size to 12.
- Switch tabs. The code text displays at
13 instead of 12.
- Adjust the code editor font size again. The setting takes effect and the text displays correctly.
Expected behavior
The code editor should retain the configured font size when switching tabs.
Relevant code
In depends/AvaloniaEdit/src/AvaloniaEdit/TextEditor.cs, OnFontSizePropertyChanged() synchronizes the font size with the internal TextView:
editor?.TextArea.TextView.SetValue(FontSizeProperty, e.NewValue);
However, the constructor does not explicitly perform this synchronization. Since Avalonia’s default FontSize is also 12, initializing the editor with 12 may not trigger the change callback.
This leaves the internal TextView able to inherit the UI font size through its ContentPresenter. The global ContentPresenter style in src/Resources/Styles.axaml binds FontSize to DefaultFontSize, which defaults to 13. Changing the editor font size afterward triggers the callback and updates TextView correctly.
Steps to reproduce
13and set the code editor font size to12.13instead of12.Expected behavior
The code editor should retain the configured font size when switching tabs.
Relevant code
In
depends/AvaloniaEdit/src/AvaloniaEdit/TextEditor.cs,OnFontSizePropertyChanged()synchronizes the font size with the internalTextView:However, the constructor does not explicitly perform this synchronization. Since Avalonia’s default
FontSizeis also12, initializing the editor with12may not trigger the change callback.This leaves the internal
TextViewable to inherit the UI font size through itsContentPresenter. The globalContentPresenterstyle insrc/Resources/Styles.axamlbindsFontSizetoDefaultFontSize, which defaults to13. Changing the editor font size afterward triggers the callback and updatesTextViewcorrectly.