[gspell/wip/entry-better-word-boundaries: 2/3] utils: add _gspell_utils_is_apostrophe_or_dash()



commit cf842f6ae37bcec965cd73a21d6bbe9eaaee170d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 21 17:33:43 2016 +0100

    utils: add _gspell_utils_is_apostrophe_or_dash()
    
    It will be used for GtkEntry too.

 gspell/gspell-text-iter.c |    5 +----
 gspell/gspell-utils.c     |   11 ++++++++++-
 gspell/gspell-utils.h     |    3 +++
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gspell/gspell-text-iter.c b/gspell/gspell-text-iter.c
index bf6edbd..fee1091 100644
--- a/gspell/gspell-text-iter.c
+++ b/gspell/gspell-text-iter.c
@@ -53,10 +53,7 @@ is_apostrophe_or_dash (const GtkTextIter *iter)
 
        ch = gtk_text_iter_get_char (iter);
 
-       return (ch == '-' ||
-               ch == '\'' ||
-               ch == _GSPELL_MODIFIER_LETTER_APOSTROPHE ||
-               ch == _GSPELL_RIGHT_SINGLE_QUOTATION_MARK);
+       return _gspell_utils_is_apostrophe_or_dash (ch);
 }
 
 gboolean
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index 4c4bc42..c2be3e8 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -2,7 +2,7 @@
  * This file is part of gspell, a spell-checking library.
  *
  * Copyright 2010 - Jesse van den Kieboom
- * Copyright 2015 - Sébastien Wilmet
+ * Copyright 2015, 2016 - 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
@@ -193,4 +193,13 @@ _gspell_utils_str_to_ascii_apostrophe (const gchar  *word,
        return TRUE;
 }
 
+gboolean
+_gspell_utils_is_apostrophe_or_dash (gunichar ch)
+{
+       return (ch == '-' ||
+               ch == '\'' ||
+               ch == _GSPELL_MODIFIER_LETTER_APOSTROPHE ||
+               ch == _GSPELL_RIGHT_SINGLE_QUOTATION_MARK);
+}
+
 /* ex:set ts=8 noet: */
diff --git a/gspell/gspell-utils.h b/gspell/gspell-utils.h
index c6eba82..89f6909 100644
--- a/gspell/gspell-utils.h
+++ b/gspell/gspell-utils.h
@@ -51,6 +51,9 @@ gboolean      _gspell_utils_str_to_ascii_apostrophe   (const gchar  *word,
                                                         gssize        word_length,
                                                         gchar       **result);
 
+G_GNUC_INTERNAL
+gboolean       _gspell_utils_is_apostrophe_or_dash     (gunichar ch);
+
 G_END_DECLS
 
 #endif /* GSPELL_UTILS_H */


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