Skip to content

[Bug] Editor font size falls back to 13 after switching tabs when set to 12 #2708

Description

@HMBSbige

Steps to reproduce

  1. Leave the default UI font size at 13 and set the code editor font size to 12.
  2. Switch tabs. The code text displays at 13 instead of 12.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions