[gnome-text-editor] recoloring: fix recoloring for locales with , as decimal



commit f8bed123f6f7cecf109605cca80e48c071eaf524
Author: Christian Hergert <chergert redhat com>
Date:   Tue Dec 7 12:09:19 2021 -0800

    recoloring: fix recoloring for locales with , as decimal
    
    Fixes #244

 src/editor-recoloring.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-recoloring.c b/src/editor-recoloring.c
index db661d2..836683e 100644
--- a/src/editor-recoloring.c
+++ b/src/editor-recoloring.c
@@ -124,6 +124,7 @@ define_color_mixed (GString       *str,
 {
   g_autofree char *a_str = NULL;
   g_autofree char *b_str = NULL;
+  char levelstr[G_ASCII_DTOSTR_BUF_SIZE];
 
   g_assert (str != NULL);
   g_assert (name != NULL);
@@ -133,7 +134,9 @@ define_color_mixed (GString       *str,
   a_str = gdk_rgba_to_string (a);
   b_str = gdk_rgba_to_string (b);
 
-  g_string_append_printf (str, "@define-color %s mix(%s,%s,%lf);\n", name, a_str, b_str, level);
+  g_ascii_dtostr (levelstr, sizeof levelstr, level);
+
+  g_string_append_printf (str, "@define-color %s mix(%s,%s,%s);\n", name, a_str, b_str, levelstr);
 }
 
 static inline void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]