[gspell/wip/underline-single] InlineCheckerTextBuffer: change underline to PANGO_UNDERLINE_SINGLE
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/underline-single] InlineCheckerTextBuffer: change underline to PANGO_UNDERLINE_SINGLE
- Date: Fri, 31 Mar 2017 16:08:48 +0000 (UTC)
commit 342b4c61f481827675b5da01022d715bdab81117
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Mar 31 17:33:35 2017 +0200
InlineCheckerTextBuffer: change underline to PANGO_UNDERLINE_SINGLE
Because PANGO_UNDERLINE_ERROR is buggy:
https://bugzilla.gnome.org/show_bug.cgi?id=763741
It'll permit to remove a hack in gspell that tries to work around the
bug (but doesn't work in all cases).
KWrite (KDE text editor) also inserts the equivalent of
PANGO_UNDERLINE_SINGLE. They maybe have the same bug with wavy
underlines.
gspell/gspell-inline-checker-text-buffer.c | 10 ++++++++--
gspell/gspell-text-view.c | 13 ++++++++-----
2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index 73997e4..30e9a96 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -2,7 +2,7 @@
* This file is part of gspell, a spell-checking library.
*
* Copyright 2002 - Paolo Maggi
- * Copyright 2015, 2016 - Sébastien Wilmet
+ * Copyright 2015, 2016, 2017 - Sébastien Wilmet
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1061,6 +1061,11 @@ set_buffer (GspellInlineCheckerTextBuffer *spell,
GspellTextBuffer *gspell_buffer;
GspellChecker *checker;
+ /* Not the full intensity for the red channel, it's more readable with
+ * the red a bit darker.
+ */
+ GdkRGBA red_color = { 0.8, 0.0, 0.0, 1.0 };
+
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
g_return_if_fail (spell->buffer == NULL);
g_return_if_fail (spell->highlight_tag == NULL);
@@ -1116,7 +1121,8 @@ set_buffer (GspellInlineCheckerTextBuffer *spell,
G_CONNECT_AFTER);
spell->highlight_tag = gtk_text_buffer_create_tag (spell->buffer, NULL,
- "underline", PANGO_UNDERLINE_ERROR,
+ "underline", PANGO_UNDERLINE_SINGLE,
+ "underline-rgba", &red_color,
NULL);
g_object_ref (spell->highlight_tag);
diff --git a/gspell/gspell-text-view.c b/gspell/gspell-text-view.c
index 453f6e8..aabd5c2 100644
--- a/gspell/gspell-text-view.c
+++ b/gspell/gspell-text-view.c
@@ -32,11 +32,11 @@
* @Short_description: Spell checking support for GtkTextView
*
* #GspellTextView extends the #GtkTextView class with inline spell checking.
- * Misspelled words are highlighted with a %PANGO_UNDERLINE_ERROR, usually a red
- * wavy underline. Right-clicking a misspelled word pops up a context menu of
- * suggested replacements. The context menu also contains an “Ignore All” item
- * to add the misspelled word to the session dictionary. And an “Add” item to
- * add the word to the personal dictionary.
+ * Misspelled words are highlighted with a red %PANGO_UNDERLINE_SINGLE.
+ * Right-clicking a misspelled word pops up a context menu of suggested
+ * replacements. The context menu also contains an “Ignore All” item to add the
+ * misspelled word to the session dictionary. And an “Add” item to add the word
+ * to the personal dictionary.
*
* For a basic use-case, there is the gspell_text_view_basic_setup() convenience
* function.
@@ -53,6 +53,9 @@
* Note that #GspellTextView extends the #GtkTextView class but without
* subclassing it, because the GtkSourceView library has already a #GtkTextView
* subclass.
+ *
+ * If you want a %PANGO_UNDERLINE_ERROR instead (a wavy underline), please fix
+ * [this bug](https://bugzilla.gnome.org/show_bug.cgi?id=763741).
*/
typedef struct _GspellTextViewPrivate GspellTextViewPrivate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]