From ca2c904e47295b54f57555849695801c670a23b3 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 25 Oct 2020 10:49:08 +0100 Subject: [PATCH] Recalculate margins size when changing font --- src/editor.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/editor.c b/src/editor.c index 1a3848f6a..055bbcfaf 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1065,6 +1065,15 @@ void editor_sci_notify_cb(G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED gint sc } +/* recalculate margins width */ +static void update_margins(ScintillaObject *sci) +{ + sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin); + sci_set_symbol_margin(sci, editor_prefs.show_markers_margin); + sci_set_folding_margin_visible(sci, editor_prefs.folding); +} + + static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *editor, SCNotification *nt, G_GNUC_UNUSED gpointer data) { @@ -1185,10 +1194,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi break; case SCN_ZOOM: - /* recalculate line margin width */ - sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin); - sci_set_symbol_margin(sci, editor_prefs.show_markers_margin); - sci_set_folding_margin_visible(sci, editor_prefs.folding); + update_margins(sci); break; } /* we always return FALSE here to let plugins handle the event too */ @@ -4610,6 +4616,7 @@ void editor_set_font(GeanyEditor *editor, const gchar *font) g_free(font_name); + update_margins(editor->sci); /* zoom to 100% to prevent confusion */ sci_zoom_off(editor->sci); } -- 2.11.4.GIT