summaryrefslogtreecommitdiff
path: root/pluma/pluma-document.c
diff options
context:
space:
mode:
authorV.Barkov <[email protected]>2016-11-20 19:28:02 +0300
committerV.Barkov <[email protected]>2016-11-20 19:28:02 +0300
commit29f4e11f08ef02d6a3c6623b8a445502e3e98ed6 (patch)
tree3fbfcf64f603e98d99d4fec53ff4aaaa17ab7c20 /pluma/pluma-document.c
parent975393b8de593f6f6cab3cc12cfce0f34c475706 (diff)
downloadpluma-29f4e11f08ef02d6a3c6623b8a445502e3e98ed6.tar.bz2
pluma-29f4e11f08ef02d6a3c6623b8a445502e3e98ed6.tar.xz
Implemented "replace all" behavior for regexp
Diffstat (limited to 'pluma/pluma-document.c')
-rw-r--r--pluma/pluma-document.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 43abf989..11ad1372 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -2009,12 +2009,12 @@ pluma_document_search_backward (PlumaDocument *doc,
{
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);
+ 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,
@@ -2109,12 +2109,23 @@ pluma_document_replace_all (PlumaDocument *doc,
do
{
- found = gtk_text_iter_forward_search (&iter,
- search_text,
- search_flags,
- &m_start,
- &m_end,
- NULL);
+ if(!PLUMA_SEARCH_IS_MATCH_REGEX(flags))
+ {
+ found = gtk_text_iter_forward_search (&iter,
+ search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ NULL);
+ }else{
+ found = pluma_gtk_text_iter_regex_search (&iter,
+ search_text,
+ search_flags,
+ &m_start,
+ &m_end,
+ NULL,
+ TRUE);
+ }
if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (flags))
{
@@ -2143,7 +2154,7 @@ pluma_document_replace_all (PlumaDocument *doc,
replace_text_len);
iter = m_start;
- }
+ }
} while (found);