From e2c321b2e20131aa97a1fe3cd5572a1883bae93a Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 11 May 2010 12:10:31 +0000 Subject: [PATCH] Only replace template filename matching start of word on saving. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4901 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/document.c | 4 ++-- src/search.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8720274bb..86e61c5d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Fix search_find_text not returning -1 when match is out of range. This fixes invalid memory reads and wrong template filename wildcard replacement. + * src/search.c, src/document.c: + Only replace template filename matching start of word on saving. 2010-05-10 Enrico Tröger diff --git a/src/document.c b/src/document.c index f58e57e52..138811743 100644 --- a/src/document.c +++ b/src/document.c @@ -93,7 +93,7 @@ GeanyFilePrefs file_prefs; * * Never assume that the order of document pointers is the same as the order of notebook tabs. * Notebook tabs can be reordered. Use @c document_get_from_page(). */ -GPtrArray *documents_array; +GPtrArray *documents_array = NULL; /* an undo action, also used for redo actions */ @@ -1504,7 +1504,7 @@ static void replace_header_filename(GeanyDocument *doc) g_return_if_fail(doc->file_type != NULL); if (doc->file_type->extension) - filebase = g_strconcat(GEANY_STRING_UNTITLED, "\\.\\w+", NULL); + filebase = g_strconcat("\\<", GEANY_STRING_UNTITLED, "\\.\\w+", NULL); else filebase = g_strdup(GEANY_STRING_UNTITLED); diff --git a/src/search.c b/src/search.c index fdece6580..3e60f6279 100644 --- a/src/search.c +++ b/src/search.c @@ -1647,6 +1647,10 @@ static gboolean compile_regex(regex_t *regex, const gchar *str, gint sflags) if (~sflags & SCFIND_MATCHCASE) rflags |= REG_ICASE; + if (sflags & (SCFIND_WHOLEWORD | SCFIND_WORDSTART)) + { + g_warning("Unsupported regex flags found!"); + } err = regcomp(regex, str, rflags); if (err != 0) -- 2.11.4.GIT