kge: : font sticks; one font per frame from the focused window
`: font NAME` was reverted on the next frame because the per-window chooser re-applied the config's code/writing font, and with two windows in different modes the font flipped every frame. Fonts per edit mode now live on the primary Editor (EditorFonts), shared with secondary windows like the buffer list. `: font` sets the font for the current buffer's mode, and the frontend picks one font per frame from the window with keyboard focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -1870,8 +1870,15 @@ cmd_font_set_by_name(const CommandContext &ctx)
|
||||
if (size <= 0.0f)
|
||||
size = 16.0f;
|
||||
}
|
||||
// The font belongs to the current buffer's edit mode: record it there,
|
||||
// or the frontend's per-mode font choice would switch straight back.
|
||||
EditMode mode = EditMode::Code;
|
||||
if (const Buffer *b = ctx.editor.CurrentBuffer())
|
||||
mode = b->GetEditMode();
|
||||
ctx.editor.Fonts().SetForMode(mode, name);
|
||||
reg.RequestLoadFont(name, size);
|
||||
ctx.editor.SetStatus(std::string("Font: ") + name + " (" + std::to_string((int) std::round(size)) + ")");
|
||||
ctx.editor.SetStatus(std::string(mode == EditMode::Writing ? "Writing font: " : "Code font: ") + name + " (" +
|
||||
std::to_string((int) std::round(size)) + ")");
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user