[gspell/wip/apostrophe: 30/30] apostrophes: use the _gspell_text_iter functions
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/apostrophe: 30/30] apostrophes: use the _gspell_text_iter functions
- Date: Sat, 5 Mar 2016 17:49:12 +0000 (UTC)
commit b59183bc85078a0922884451cdb7b0413351ec9f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Mar 5 18:30:52 2016 +0100
apostrophes: use the _gspell_text_iter functions
gspell/gspell-inline-checker-text-buffer.c | 69 ++++++++++++++--------------
gspell/gspell-navigator-text-view.c | 25 +++++-----
gspell/gspell-utils.c | 5 +-
3 files changed, 51 insertions(+), 48 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index 6508627..33815b7 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -29,6 +29,7 @@
#include "gspell-checker.h"
#include "gspell-buffer-notifier.h"
#include "gspell-text-buffer.h"
+#include "gspell-text-iter.h"
#include "gspell-text-region.h"
#include "gspell-utils.h"
@@ -102,8 +103,8 @@ check_word (GspellInlineCheckerTextBuffer *spell,
return;
}
- if (!gtk_text_iter_starts_word (start) ||
- !gtk_text_iter_ends_word (end))
+ if (!_gspell_text_iter_starts_word (start) ||
+ !_gspell_text_iter_ends_word (end))
{
g_warning ("Spell checking: @start and @end must delimit a word");
return;
@@ -140,30 +141,30 @@ adjust_iters (GtkTextIter *start,
switch (mode)
{
case ADJUST_MODE_STRICTLY_INSIDE_WORD:
- if (gtk_text_iter_inside_word (start) &&
- !gtk_text_iter_starts_word (start))
+ if (_gspell_text_iter_inside_word (start) &&
+ !_gspell_text_iter_starts_word (start))
{
- gtk_text_iter_backward_word_start (start);
+ _gspell_text_iter_backward_word_start (start);
}
- if (gtk_text_iter_inside_word (end) &&
- !gtk_text_iter_starts_word (end))
+ if (_gspell_text_iter_inside_word (end) &&
+ !_gspell_text_iter_starts_word (end))
{
- gtk_text_iter_forward_word_end (end);
+ _gspell_text_iter_forward_word_end (end);
}
break;
case ADJUST_MODE_INCLUDE_NEIGHBORS:
- if (gtk_text_iter_ends_word (start) ||
- (gtk_text_iter_inside_word (start) &&
- !gtk_text_iter_starts_word (start)))
+ if (_gspell_text_iter_ends_word (start) ||
+ (_gspell_text_iter_inside_word (start) &&
+ !_gspell_text_iter_starts_word (start)))
{
- gtk_text_iter_backward_word_start (start);
+ _gspell_text_iter_backward_word_start (start);
}
- if (gtk_text_iter_inside_word (end))
+ if (_gspell_text_iter_inside_word (end))
{
- gtk_text_iter_forward_word_end (end);
+ _gspell_text_iter_forward_word_end (end);
}
break;
@@ -189,9 +190,9 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
end);
word_start = *start;
- if (!gtk_text_iter_starts_word (&word_start))
+ if (!_gspell_text_iter_starts_word (&word_start))
{
- gtk_text_iter_forward_word_end (&word_start);
+ _gspell_text_iter_forward_word_end (&word_start);
/* Didn't move, there is no words after @start_adjusted. */
if (gtk_text_iter_equal (&word_start, start))
@@ -199,8 +200,8 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
return;
}
- gtk_text_iter_backward_word_start (&word_start);
- g_assert (gtk_text_iter_starts_word (&word_start));
+ _gspell_text_iter_backward_word_start (&word_start);
+ g_assert (_gspell_text_iter_starts_word (&word_start));
g_assert_cmpint (gtk_text_iter_compare (start, &word_start), <, 0);
}
@@ -210,18 +211,18 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
GtkTextIter word_end;
GtkTextIter next_word_start;
- g_assert (gtk_text_iter_starts_word (&word_start));
+ g_assert (_gspell_text_iter_starts_word (&word_start));
word_end = word_start;
- gtk_text_iter_forward_word_end (&word_end);
+ _gspell_text_iter_forward_word_end (&word_end);
g_assert_cmpint (gtk_text_iter_compare (&word_end, end), <=, 0);
check_word (spell, &word_start, &word_end);
next_word_start = word_end;
- gtk_text_iter_forward_word_end (&next_word_start);
- gtk_text_iter_backward_word_start (&next_word_start);
+ _gspell_text_iter_forward_word_end (&next_word_start);
+ _gspell_text_iter_backward_word_start (&next_word_start);
/* Make sure we've actually advanced (we don't advance if we
* have just checked the last word of the buffer).
@@ -645,8 +646,8 @@ delete_range_before_cb (GtkTextBuffer *buffer,
if (is_backspace)
{
- if (gtk_text_iter_inside_word (start) ||
- gtk_text_iter_ends_word (start))
+ if (_gspell_text_iter_inside_word (start) ||
+ _gspell_text_iter_ends_word (start))
{
spell->check_current_word = FALSE;
}
@@ -657,8 +658,8 @@ delete_range_before_cb (GtkTextBuffer *buffer,
}
else if (is_delete)
{
- if (gtk_text_iter_inside_word (end) ||
- gtk_text_iter_ends_word (end))
+ if (_gspell_text_iter_inside_word (end) ||
+ _gspell_text_iter_ends_word (end))
{
spell->check_current_word = FALSE;
}
@@ -716,22 +717,22 @@ get_word_extents_at_click_position (GspellInlineCheckerTextBuffer *spell,
gtk_text_buffer_get_iter_at_mark (spell->buffer, &iter, spell->mark_click);
- if (!gtk_text_iter_inside_word (&iter) &&
- !gtk_text_iter_ends_word (&iter))
+ if (!_gspell_text_iter_inside_word (&iter) &&
+ !_gspell_text_iter_ends_word (&iter))
{
return FALSE;
}
*start = iter;
- if (!gtk_text_iter_starts_word (start))
+ if (!_gspell_text_iter_starts_word (start))
{
- gtk_text_iter_backward_word_start (start);
+ _gspell_text_iter_backward_word_start (start);
}
*end = iter;
- if (!gtk_text_iter_ends_word (end))
+ if (!_gspell_text_iter_ends_word (end))
{
- gtk_text_iter_forward_word_end (end);
+ _gspell_text_iter_forward_word_end (end);
}
return TRUE;
@@ -994,8 +995,8 @@ remove_tag_to_word (GspellInlineCheckerTextBuffer *spell,
break;
}
- if (gtk_text_iter_starts_word (&match_start) &&
- gtk_text_iter_ends_word (&match_end))
+ if (_gspell_text_iter_starts_word (&match_start) &&
+ _gspell_text_iter_ends_word (&match_end))
{
gtk_text_buffer_remove_tag (spell->buffer,
spell->highlight_tag,
diff --git a/gspell/gspell-navigator-text-view.c b/gspell/gspell-navigator-text-view.c
index 1a8f66d..4e3d5c8 100644
--- a/gspell/gspell-navigator-text-view.c
+++ b/gspell/gspell-navigator-text-view.c
@@ -21,6 +21,7 @@
#include "gspell-navigator-text-view.h"
#include <glib/gi18n-lib.h>
#include "gspell-text-buffer.h"
+#include "gspell-text-iter.h"
#include "gspell-utils.h"
/**
@@ -95,15 +96,15 @@ init_boundaries (GspellNavigatorTextView *navigator)
gtk_text_buffer_get_bounds (priv->buffer, &start, &end);
}
- if (gtk_text_iter_inside_word (&start) &&
- !gtk_text_iter_starts_word (&start))
+ if (_gspell_text_iter_inside_word (&start) &&
+ !_gspell_text_iter_starts_word (&start))
{
- gtk_text_iter_backward_word_start (&start);
+ _gspell_text_iter_backward_word_start (&start);
}
- if (gtk_text_iter_inside_word (&end))
+ if (_gspell_text_iter_inside_word (&end))
{
- gtk_text_iter_forward_word_end (&end);
+ _gspell_text_iter_forward_word_end (&end);
}
priv->start_boundary = gtk_text_buffer_create_mark (priv->buffer, NULL, &start, TRUE);
@@ -345,12 +346,12 @@ gspell_navigator_text_view_goto_next (GspellNavigator *navigator,
gboolean correctly_spelled;
GError *error = NULL;
- if (!gtk_text_iter_starts_word (&word_start))
+ if (!_gspell_text_iter_starts_word (&word_start))
{
GtkTextIter iter;
iter = word_start;
- gtk_text_iter_forward_word_end (&word_start);
+ _gspell_text_iter_forward_word_end (&word_start);
if (gtk_text_iter_equal (&iter, &word_start))
{
@@ -358,7 +359,7 @@ gspell_navigator_text_view_goto_next (GspellNavigator *navigator,
return FALSE;
}
- gtk_text_iter_backward_word_start (&word_start);
+ _gspell_text_iter_backward_word_start (&word_start);
}
if (!_gspell_utils_skip_no_spell_check (no_spell_check_tag, &word_start, &end))
@@ -366,10 +367,10 @@ gspell_navigator_text_view_goto_next (GspellNavigator *navigator,
return FALSE;
}
- g_return_val_if_fail (gtk_text_iter_starts_word (&word_start), FALSE);
+ g_return_val_if_fail (_gspell_text_iter_starts_word (&word_start), FALSE);
word_end = word_start;
- gtk_text_iter_forward_word_end (&word_end);
+ _gspell_text_iter_forward_word_end (&word_end);
if (gtk_text_iter_compare (&end, &word_end) < 0)
{
@@ -489,8 +490,8 @@ gspell_navigator_text_view_change_all (GspellNavigator *navigator,
break;
}
- if (gtk_text_iter_starts_word (&match_start) &&
- gtk_text_iter_ends_word (&match_end))
+ if (_gspell_text_iter_starts_word (&match_start) &&
+ _gspell_text_iter_ends_word (&match_end))
{
gtk_text_buffer_delete (priv->buffer, &match_start, &match_end);
gtk_text_buffer_insert (priv->buffer, &match_end, change_to, -1);
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index ba287f8..c10278a 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -20,6 +20,7 @@
#include "gspell-utils.h"
#include <string.h>
+#include "gspell-text-iter.h"
gboolean
_gspell_utils_is_number (const gchar *text,
@@ -95,8 +96,8 @@ _gspell_utils_skip_no_spell_check (GtkTextTag *no_spell_check_tag,
return FALSE;
}
- gtk_text_iter_forward_word_end (start);
- gtk_text_iter_backward_word_start (start);
+ _gspell_text_iter_forward_word_end (start);
+ _gspell_text_iter_backward_word_start (start);
if (gtk_text_iter_compare (start, &last) <= 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]