summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV.Barkov <[email protected]>2016-11-24 20:18:27 +0300
committerV.Barkov <[email protected]>2016-11-24 20:18:27 +0300
commit2314b3828cbe540d65ba517c32872476417501a6 (patch)
tree389ad57d86d0c3b1ecd6498e7327cbc05ebfbd7e
parent9f79aa764fa8b31b204f79ca452502204bbfa09d (diff)
downloadpluma-2314b3828cbe540d65ba517c32872476417501a6.tar.bz2
pluma-2314b3828cbe540d65ba517c32872476417501a6.tar.xz
Fixed formatting [2]
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.c12
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.h2
-rw-r--r--pluma/pluma-document.c171
-rw-r--r--pluma/pluma-document.h4
-rw-r--r--pluma/pluma-utils.c180
-rw-r--r--pluma/pluma-utils.h11
6 files changed, 190 insertions, 190 deletions
diff --git a/pluma/dialogs/pluma-search-dialog.c b/pluma/dialogs/pluma-search-dialog.c
index 6263b937..a77701c0 100755
--- a/pluma/dialogs/pluma-search-dialog.c
+++ b/pluma/dialogs/pluma-search-dialog.c
@@ -68,7 +68,7 @@ struct _PlumaSearchDialogPrivate
GtkWidget *replace_entry;
GtkWidget *replace_text_entry;
GtkWidget *match_case_checkbutton;
- GtkWidget *match_regex_checkbutton;
+ GtkWidget *match_regex_checkbutton;
GtkWidget *entire_word_checkbutton;
GtkWidget *backwards_checkbutton;
GtkWidget *wrap_around_checkbutton;
@@ -353,7 +353,7 @@ pluma_search_dialog_init (PlumaSearchDialog *dlg)
"search_label", &dlg->priv->search_label,
"replace_with_label", &dlg->priv->replace_label,
"match_case_checkbutton", &dlg->priv->match_case_checkbutton,
- "match_regex_checkbutton",&dlg->priv->match_regex_checkbutton,
+ "match_regex_checkbutton",&dlg->priv->match_regex_checkbutton,
"entire_word_checkbutton", &dlg->priv->entire_word_checkbutton,
"search_backwards_checkbutton", &dlg->priv->backwards_checkbutton,
"wrap_around_checkbutton", &dlg->priv->wrap_around_checkbutton,
@@ -588,18 +588,18 @@ void
pluma_search_dialog_set_match_regex (PlumaSearchDialog *dialog,
gboolean match_case)
{
- g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->match_regex_checkbutton),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->match_regex_checkbutton),
match_case);
}
gboolean
pluma_search_dialog_get_match_regex (PlumaSearchDialog *dialog)
{
- g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->match_regex_checkbutton));
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->match_regex_checkbutton));
}
void
diff --git a/pluma/dialogs/pluma-search-dialog.h b/pluma/dialogs/pluma-search-dialog.h
index e6ebe8dc..e397b258 100755
--- a/pluma/dialogs/pluma-search-dialog.h
+++ b/pluma/dialogs/pluma-search-dialog.h
@@ -112,7 +112,7 @@ void pluma_search_dialog_set_match_case (PlumaSearchDialog *dialog,
gboolean pluma_search_dialog_get_match_case (PlumaSearchDialog *dialog);
void pluma_search_dialog_set_match_regex (PlumaSearchDialog *dialog,
- gboolean match_case);
+ gboolean match_case);
gboolean pluma_search_dialog_get_match_regex (PlumaSearchDialog *dialog);
void pluma_search_dialog_set_entire_word (PlumaSearchDialog *dialog,
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 11ad1372..3fe939f5 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -1919,24 +1919,24 @@ pluma_document_search_forward (PlumaDocument *doc,
while (!found)
{
- if(!PLUMA_SEARCH_IS_MATCH_REGEX(doc->priv->search_flags))
- {
- found = gtk_text_iter_forward_search (&iter,
- doc->priv->search_text,
- search_flags,
- &m_start,
- &m_end,
- end);
- }else{
- found = pluma_gtk_text_iter_regex_search (&iter,
- doc->priv->search_text,
- search_flags,
- &m_start,
- &m_end,
- end,
- TRUE);
- }
-
+ if(!PLUMA_SEARCH_IS_MATCH_REGEX(doc->priv->search_flags))
+ {
+ found = gtk_text_iter_forward_search (&iter,
+ doc->priv->search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ end);
+ }else{
+ found = pluma_gtk_text_iter_regex_search (&iter,
+ doc->priv->search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ end,
+ TRUE);
+ }
+
if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (doc->priv->search_flags))
{
found = gtk_text_iter_starts_word (&m_start) &&
@@ -1973,78 +1973,79 @@ pluma_document_search_backward (PlumaDocument *doc,
GtkTextIter *match_start,
GtkTextIter *match_end)
{
- GtkTextIter iter;
- GtkTextSearchFlags search_flags;
- gboolean found = FALSE;
- GtkTextIter m_start;
- GtkTextIter m_end;
-
- g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE);
- g_return_val_if_fail ((start == NULL) ||
- (gtk_text_iter_get_buffer (start) == GTK_TEXT_BUFFER (doc)), FALSE);
- g_return_val_if_fail ((end == NULL) ||
- (gtk_text_iter_get_buffer (end) == GTK_TEXT_BUFFER (doc)), FALSE);
-
- if (doc->priv->search_text == NULL)
- {
- pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == NULL\n");
- return FALSE;
- }
- else
- pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == \"%s\"\n", doc->priv->search_text);
-
- if (end == NULL)
- gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
- else
- iter = *end;
-
- search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
-
- if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
- {
- search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
- }
-
- while (!found)
- {
- if(!PLUMA_SEARCH_IS_MATCH_REGEX(doc->priv->search_flags))
- {
- found = gtk_text_iter_backward_search (&iter,
- doc->priv->search_text,
- search_flags,
- &m_start,
- &m_end,
- start);
- }
- else{
- found = pluma_gtk_text_iter_regex_search (&iter,
- doc->priv->search_text,
- search_flags,
- &m_start,
- &m_end,
- end,
- FALSE);
- }
+ GtkTextIter iter;
+ GtkTextSearchFlags search_flags;
+ gboolean found = FALSE;
+ GtkTextIter m_start;
+ GtkTextIter m_end;
- if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (doc->priv->search_flags))
- {
- found = gtk_text_iter_starts_word (&m_start) &&
- gtk_text_iter_ends_word (&m_end);
+ g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE);
+ g_return_val_if_fail ((start == NULL) ||
+( gtk_text_iter_get_buffer (start) == GTK_TEXT_BUFFER (doc)), FALSE);
+ g_return_val_if_fail ((end == NULL) ||
+ (gtk_text_iter_get_buffer (end) == GTK_TEXT_BUFFER (doc)), FALSE);
- if (!found)
- iter = m_start;
- }
- else
- break;
- }
+ if (doc->priv->search_text == NULL)
+ {
+ pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == NULL\n");
+ return FALSE;
+ }
+ else
+ pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == \"%s\"\n", doc->priv->search_text);
+
+ if (end == NULL)
+ gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
+ else
+ iter = *end;
+
+ search_flags = GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY;
+
+ if (!PLUMA_SEARCH_IS_CASE_SENSITIVE (doc->priv->search_flags))
+ {
+ search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE;
+ }
+
+ while (!found)
+ {
+ if(!PLUMA_SEARCH_IS_MATCH_REGEX(doc->priv->search_flags))
+ {
+ found = gtk_text_iter_backward_search (&iter,
+ doc->priv->search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ start);
+ }
+ else
+ {
+ found = pluma_gtk_text_iter_regex_search (&iter,
+ doc->priv->search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ end,
+ FALSE);
+ }
- if (found && (match_start != NULL))
- *match_start = m_start;
+ if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (doc->priv->search_flags))
+ {
+ found = gtk_text_iter_starts_word (&m_start) &&
+ gtk_text_iter_ends_word (&m_end);
- if (found && (match_end != NULL))
- *match_end = m_end;
+ if (!found)
+ iter = m_start;
+ }
+ else
+ break;
+ }
+
+ if (found && (match_start != NULL))
+ *match_start = m_start;
+
+ if (found && (match_end != NULL))
+ *match_end = m_end;
- return found;
+ return found;
}
/* FIXME this is an issue for introspection regardning @find */
diff --git a/pluma/pluma-document.h b/pluma/pluma-document.h
index ee8d6f88..a8d64895 100644
--- a/pluma/pluma-document.h
+++ b/pluma/pluma-document.h
@@ -69,8 +69,8 @@ typedef enum
PLUMA_SEARCH_DONT_SET_FLAGS = 1 << 0,
PLUMA_SEARCH_ENTIRE_WORD = 1 << 1,
PLUMA_SEARCH_CASE_SENSITIVE = 1 << 2,
- PLUMA_SEARCH_PARSE_ESCAPES = 1 << 3,
- PLUMA_SEARCH_MATCH_REGEX = 1 << 4,
+ PLUMA_SEARCH_PARSE_ESCAPES = 1 << 3,
+ PLUMA_SEARCH_MATCH_REGEX = 1 << 4,
} PlumaSearchFlags;
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index a5f67a2c..868a5bd8 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -1574,95 +1574,95 @@ pluma_utils_decode_uri (const gchar *uri,
gboolean
pluma_gtk_text_iter_regex_search (const GtkTextIter *iter,
- const gchar *str,
- GtkTextSearchFlags flags,
- GtkTextIter *match_start,
- GtkTextIter *match_end,
- const GtkTextIter *limit,
- gboolean forward_search)
+ const gchar *str,
+ GtkTextSearchFlags flags,
+ GtkTextIter *match_start,
+ GtkTextIter *match_end,
+ const GtkTextIter *limit,
+ gboolean forward_search)
{
- GRegex *regex;
- GRegexCompileFlags compile_flags;
- GMatchInfo *match_info;
- gchar *text;
- GtkTextIter *begin_iter;
- GtkTextIter *end_iter;
- gchar **all_matches;
- gchar *match_string;
- gboolean found;
-
- compile_flags = 0;
- if ((flags & GTK_TEXT_SEARCH_CASE_INSENSITIVE) != 0)
- compile_flags |= G_REGEX_CASELESS;
-
- regex = g_regex_new (str,compile_flags,0,NULL);
- if (regex == NULL)
- return FALSE;
-
- begin_iter=gtk_text_iter_copy(iter);
- if (limit == NULL)
- {
- end_iter=gtk_text_iter_copy(begin_iter);
- if(forward_search)
- {
- gtk_text_buffer_get_end_iter(gtk_text_iter_get_buffer(begin_iter),
- end_iter);
- }
- else
- {
- gtk_text_buffer_get_start_iter(gtk_text_iter_get_buffer(begin_iter),
- end_iter);
- }
- }
- else
- {
- end_iter=gtk_text_iter_copy(limit);
- }
-
- if ((flags & GTK_TEXT_SEARCH_TEXT_ONLY) != 0)
- {
- if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0)
- text=gtk_text_iter_get_visible_text(begin_iter,end_iter);
- else
- text=gtk_text_iter_get_text(begin_iter,end_iter);
- }
- else
- {
- if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0)
- text=gtk_text_iter_get_visible_slice(begin_iter,end_iter);
- else
- text=gtk_text_iter_get_slice(begin_iter,end_iter);
- }
-
- found = g_regex_match_all(regex,text,0,&match_info);
- if (found)
- {
- all_matches=g_match_info_fetch_all(match_info);
- if(forward_search)
- {
- match_string=all_matches[0];
- gtk_text_iter_forward_search(begin_iter
- ,match_string
- ,flags
- ,match_start
- ,match_end
- ,limit);
- }
- else
- {
- match_string=all_matches[g_strv_length(all_matches)-1];
- gtk_text_iter_backward_search(begin_iter
- ,match_string
- ,flags
- ,match_start
- ,match_end
- ,limit);
- }
- }
-
- gtk_text_iter_free(begin_iter);
- gtk_text_iter_free(end_iter);
- g_match_info_free (match_info);
- g_regex_unref (regex);
- return found;
+ GRegex *regex;
+ GRegexCompileFlags compile_flags;
+ GMatchInfo *match_info;
+ gchar *text;
+ GtkTextIter *begin_iter;
+ GtkTextIter *end_iter;
+ gchar **all_matches;
+ gchar *match_string;
+ gboolean found;
+
+ compile_flags = 0;
+ if ((flags & GTK_TEXT_SEARCH_CASE_INSENSITIVE) != 0)
+ compile_flags |= G_REGEX_CASELESS;
+
+ regex = g_regex_new (str,compile_flags,0,NULL);
+ if (regex == NULL)
+ return FALSE;
+
+ begin_iter=gtk_text_iter_copy(iter);
+ if (limit == NULL)
+ {
+ end_iter=gtk_text_iter_copy(begin_iter);
+ if(forward_search)
+ {
+ gtk_text_buffer_get_end_iter(gtk_text_iter_get_buffer(begin_iter),
+ end_iter);
+ }
+ else
+ {
+ gtk_text_buffer_get_start_iter(gtk_text_iter_get_buffer(begin_iter),
+ end_iter);
+ }
+ }
+ else
+ {
+ end_iter=gtk_text_iter_copy(limit);
+ }
+
+ if ((flags & GTK_TEXT_SEARCH_TEXT_ONLY) != 0)
+ {
+ if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0)
+ text=gtk_text_iter_get_visible_text(begin_iter,end_iter);
+ else
+ text=gtk_text_iter_get_text(begin_iter,end_iter);
+ }
+ else
+ {
+ if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0)
+ text=gtk_text_iter_get_visible_slice(begin_iter,end_iter);
+ else
+ text=gtk_text_iter_get_slice(begin_iter,end_iter);
+ }
+
+ found = g_regex_match_all(regex,text,0,&match_info);
+ if (found)
+ {
+ all_matches=g_match_info_fetch_all(match_info);
+ if(forward_search)
+ {
+ match_string=all_matches[0];
+ gtk_text_iter_forward_search(begin_iter,
+ match_string,
+ flags,
+ match_start,
+ match_end,
+ limit);
+ }
+ else
+ {
+ match_string=all_matches[g_strv_length(all_matches)-1];
+ gtk_text_iter_backward_search(begin_iter,
+ match_string,
+ flags,
+ match_start,
+ match_end,
+ limit);
+ }
+ }
+
+ gtk_text_iter_free(begin_iter);
+ gtk_text_iter_free(end_iter);
+ g_match_info_free (match_info);
+ g_regex_unref (regex);
+ return found;
}
diff --git a/pluma/pluma-utils.h b/pluma/pluma-utils.h
index fb62ec48..be54f786 100644
--- a/pluma/pluma-utils.h
+++ b/pluma/pluma-utils.h
@@ -154,14 +154,13 @@ gchar **pluma_utils_drop_get_uris (GtkSelectionData *selection_data);
/* Provides regexp forward search */
gboolean
pluma_gtk_text_iter_regex_search (const GtkTextIter *iter,
- const gchar *str,
- GtkTextSearchFlags flags,
- GtkTextIter *match_start,
- GtkTextIter *match_end,
- const GtkTextIter *limit, gboolean forward_search);
+ const gchar *str,
+ GtkTextSearchFlags flags,
+ GtkTextIter *match_start,
+ GtkTextIter *match_end,
+ const GtkTextIter *limit, gboolean forward_search);
G_END_DECLS
#endif /* __PLUMA_UTILS_H__ */
-