[gnome-text-editor] spellcheck: use PANGO_UNDERLINE_ERROR_LINE



commit 8d4d36d7f76800ef87cfa471a281ede77f5564f6
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 31 12:58:53 2022 -0700

    spellcheck: use PANGO_UNDERLINE_ERROR_LINE
    
    We can't rely on PANGO_UNDERLINE_ERROR as that may change the baseline
    position based on the glyph. This is problematic with mixed language sets
    as it comes off very uncoordinated.
    
    With PANGO_UNDERLINE_ERROR_LINE, we also need to set a color since we would
    get the text foreground color by default. Plain red (1,0,0) is pretty ugly
    so I've just chosen the center red color from the Adwaita palette as our
    default red.
    
    Someday, we might want this to come from GtkSourceView, particularly if we
    land spellcheck in either GTK or GtkSourceView.
    
    Related to GNOME/gtk#4956
    Related to #385

 src/editor-text-buffer-spell-adapter.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-text-buffer-spell-adapter.c b/src/editor-text-buffer-spell-adapter.c
index e2cde23..bd9210a 100644
--- a/src/editor-text-buffer-spell-adapter.c
+++ b/src/editor-text-buffer-spell-adapter.c
@@ -386,12 +386,17 @@ apply_error_style_cb (GtkSourceBuffer *buffer,
 {
   GtkSourceStyleScheme *scheme;
   GtkSourceStyle *style;
+  static GdkRGBA error_color;
 
   g_assert (GTK_SOURCE_IS_BUFFER (buffer));
   g_assert (GTK_IS_TEXT_TAG (tag));
 
+  if G_UNLIKELY (error_color.alpha == .0)
+    gdk_rgba_parse (&error_color, "#e01b24");
+
   g_object_set (tag,
-                "underline", PANGO_UNDERLINE_ERROR,
+                "underline", PANGO_UNDERLINE_ERROR_LINE,
+                "underline-rgba", &error_color,
                 "background-set", FALSE,
                 "foreground-set", FALSE,
                 "weight-set", FALSE,


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