[gtksourceview] SearchContext: make match_start param of regex_replace() const
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] SearchContext: make match_start param of regex_replace() const
- Date: Sat, 4 Jun 2016 16:30:14 +0000 (UTC)
commit eb5ec29e7c4ad71c07f5e7b92a00c87367ae1aaa
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 4 18:06:59 2016 +0200
SearchContext: make match_start param of regex_replace() const
So that the function prototype is clearer, it's self-documented.
It's my 1000th commit anniversary on the master branch, let's celebrate!
This commit is the kind of commit that perfectly reflects a good chunk
of the work I've done in GtkSourceView to stabilize it and make it
easier to maintain.
gtksourceview/gtksourcesearchcontext.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 6444f55..d1f947d 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -3436,7 +3436,7 @@ gtk_source_search_context_backward_finish (GtkSourceSearchContext *search,
*/
static gboolean
regex_replace (GtkSourceSearchContext *search,
- GtkTextIter *match_start,
+ const GtkTextIter *match_start,
GtkTextIter *match_end,
const gchar *replace,
GError **error)
@@ -3445,6 +3445,7 @@ regex_replace (GtkSourceSearchContext *search,
GtkTextIter real_end;
GtkTextIter match_start_check;
GtkTextIter match_end_check;
+ GtkTextIter match_start_copy;
gint start_pos;
gchar *subject;
gchar *suffix;
@@ -3511,8 +3512,10 @@ regex_replace (GtkSourceSearchContext *search,
subject_replaced[strlen (subject_replaced) - strlen (suffix)] = '\0';
g_return_val_if_fail (strlen (subject_replaced) >= (guint)start_pos, FALSE);
+ match_start_copy = *match_start;
+
gtk_text_buffer_begin_user_action (search->priv->buffer);
- gtk_text_buffer_delete (search->priv->buffer, match_start, match_end);
+ gtk_text_buffer_delete (search->priv->buffer, &match_start_copy, match_end);
gtk_text_buffer_insert (search->priv->buffer, match_end, subject_replaced + start_pos, -1);
gtk_text_buffer_end_user_action (search->priv->buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]