[gspell/wip/apostrophe: 2/2] Use the _gspell_text_iter_* functions for the apostrophe support
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/apostrophe: 2/2] Use the _gspell_text_iter_* functions for the apostrophe support
- Date: Fri, 12 Feb 2016 16:21:18 +0000 (UTC)
commit e20e442e616b3fe1cf99028ee03578be2096b7ec
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Feb 12 17:17:50 2016 +0100
Use the _gspell_text_iter_* functions for the apostrophe support
gspell/gspell-inline-checker-text-buffer.c | 49 ++++++++++++++-------------
gspell/gspell-navigator-text-view.c | 15 ++++----
gspell/gspell-utils.c | 5 ++-
3 files changed, 36 insertions(+), 33 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index c69dac1..bac63a7 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"
@@ -135,16 +136,16 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
g_assert_cmpint (gtk_text_iter_compare (start, end), <=, 0);
- if (gtk_text_iter_inside_word (start) &&
+ if (_gspell_text_iter_inside_word (start) &&
!gtk_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_starts_word (end))
{
- gtk_text_iter_forward_word_end (end);
+ _gspell_text_iter_forward_word_end (end);
}
gtk_text_buffer_remove_tag (spell->buffer,
@@ -155,7 +156,7 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
word_start = *start;
if (!gtk_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))
@@ -163,7 +164,7 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
return;
}
- gtk_text_iter_backward_word_start (&word_start);
+ _gspell_text_iter_backward_word_start (&word_start);
g_assert (gtk_text_iter_starts_word (&word_start));
g_assert_cmpint (gtk_text_iter_compare (start, &word_start), <, 0);
}
@@ -177,15 +178,15 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
g_assert (gtk_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).
@@ -286,17 +287,17 @@ get_current_word_boundaries (GtkTextBuffer *buffer,
*current_word_start = insert_iter;
if (gtk_text_iter_ends_word (current_word_start) ||
- (gtk_text_iter_inside_word (current_word_start) &&
+ (_gspell_text_iter_inside_word (current_word_start) &&
!gtk_text_iter_starts_word (current_word_start)))
{
- gtk_text_iter_backward_word_start (current_word_start);
+ _gspell_text_iter_backward_word_start (current_word_start);
found = TRUE;
}
*current_word_end = insert_iter;
- if (gtk_text_iter_inside_word (current_word_end))
+ if (_gspell_text_iter_inside_word (current_word_end))
{
- gtk_text_iter_forward_word_end (current_word_end);
+ _gspell_text_iter_forward_word_end (current_word_end);
found = TRUE;
}
@@ -496,15 +497,15 @@ insert_text_after_cb (GtkTextBuffer *buffer,
/* Include neighbor words */
if (gtk_text_iter_ends_word (&start) ||
- (gtk_text_iter_inside_word (&start) &&
+ (_gspell_text_iter_inside_word (&start) &&
!gtk_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);
}
spell->check_current_word = FALSE;
@@ -528,15 +529,15 @@ delete_range_after_cb (GtkTextBuffer *buffer,
gtk_text_iter_order (&start_adjusted, &end_adjusted);
if (gtk_text_iter_ends_word (&start_adjusted) ||
- (gtk_text_iter_inside_word (&start_adjusted) &&
+ (_gspell_text_iter_inside_word (&start_adjusted) &&
!gtk_text_iter_starts_word (&start_adjusted)))
{
- gtk_text_iter_backward_word_start (&start_adjusted);
+ _gspell_text_iter_backward_word_start (&start_adjusted);
}
- if (gtk_text_iter_inside_word (&end_adjusted))
+ if (_gspell_text_iter_inside_word (&end_adjusted))
{
- gtk_text_iter_forward_word_end (&end_adjusted);
+ _gspell_text_iter_forward_word_end (&end_adjusted);
}
spell->check_current_word = FALSE;
@@ -566,7 +567,7 @@ 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) &&
+ if (!_gspell_text_iter_inside_word (&iter) &&
!gtk_text_iter_ends_word (&iter))
{
return FALSE;
@@ -575,13 +576,13 @@ get_word_extents_at_click_position (GspellInlineCheckerTextBuffer *spell,
*start = iter;
if (!gtk_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))
{
- gtk_text_iter_forward_word_end (end);
+ _gspell_text_iter_forward_word_end (end);
}
return TRUE;
diff --git a/gspell/gspell-navigator-text-view.c b/gspell/gspell-navigator-text-view.c
index 1a8f66d..190f5b8 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) &&
+ if (_gspell_text_iter_inside_word (&start) &&
!gtk_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);
@@ -350,7 +351,7 @@ gspell_navigator_text_view_goto_next (GspellNavigator *navigator,
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))
@@ -369,7 +370,7 @@ gspell_navigator_text_view_goto_next (GspellNavigator *navigator,
g_return_val_if_fail (gtk_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)
{
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]