@@ -250,6 +250,25 @@ reformat_separators(MathEquation *equation)
250250 else if (c == mp_serializer_get_radix (equation -> priv -> serializer )) {
251251 in_number = in_radix = TRUE;
252252 }
253+ else if (c == ',' && in_number ) {
254+ /* Convert comma to proper radix character for French decimal separator support */
255+ GtkTextIter start , end ;
256+ gchar buffer [7 ];
257+ gint len ;
258+
259+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (equation ), & start , offset );
260+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (equation ), & end , offset + 1 );
261+ gtk_text_buffer_delete (GTK_TEXT_BUFFER (equation ), & start , & end );
262+
263+ /* Get new iterator position after deletion */
264+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (equation ), & start , offset );
265+ len = g_unichar_to_utf8 (mp_serializer_get_radix (equation -> priv -> serializer ), buffer );
266+ buffer [len ] = '\0' ;
267+ gtk_text_buffer_insert (GTK_TEXT_BUFFER (equation ), & start , buffer , -1 );
268+
269+ in_radix = TRUE;
270+ /* No need to adjust offset since we're replacing one char with one char */
271+ }
253272 else if (c == mp_serializer_get_thousands_separator (equation -> priv -> serializer )) {
254273 /* Didn't expect thousands separator - delete it */
255274 if (!expect_tsep && in_number ) {
@@ -809,6 +828,9 @@ math_equation_get_equation(MathEquation *equation)
809828 /* Substitute radix character */
810829 else if (c == mp_serializer_get_radix (equation -> priv -> serializer ) && (last_is_digit || next_is_digit ))
811830 g_string_append_unichar (eq_text , '.' );
831+ /* Support comma as decimal separator (French convention) */
832+ else if (c == ',' && last_is_digit && next_is_digit )
833+ g_string_append_unichar (eq_text , '.' );
812834 else
813835 g_string_append_unichar (eq_text , c );
814836
0 commit comments