Revision: 4793 http://geany.svn.sourceforge.net/geany/?rev=4793&view=rev Author: ntrel Date: 2010-03-31 11:53:37 +0000 (Wed, 31 Mar 2010)
Log Message: ----------- Fix replacing '^' regex.
Modified Paths: -------------- trunk/ChangeLog trunk/src/search.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-03-31 11:35:31 UTC (rev 4792) +++ trunk/ChangeLog 2010-03-31 11:53:37 UTC (rev 4793) @@ -2,6 +2,8 @@
* plugins/classbuilder.c: Beep if the user hasn't entered a class name on pressing OK. + * src/search.c: + Fix replacing '^' regex.
2010-03-30 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/search.c =================================================================== --- trunk/src/search.c 2010-03-31 11:35:31 UTC (rev 4792) +++ trunk/src/search.c 2010-03-31 11:53:37 UTC (rev 4793) @@ -1676,12 +1676,17 @@ static gint find_regex(ScintillaObject *sci, guint pos, regex_t *regex) { const gchar *text; + gint flags = 0;
g_return_val_if_fail(pos <= (guint)sci_get_length(sci), FALSE);
+ if (sci_get_col_from_position(sci, pos) != 0) + flags = REG_NOTBOL; + /* Warning: any SCI calls will invalidate 'text' after calling SCI_GETCHARACTERPOINTER */ text = (void*)scintilla_send_message(sci, SCI_GETCHARACTERPOINTER, 0, 0); text += pos; - if (regexec(regex, text, G_N_ELEMENTS(regex_matches), regex_matches, 0) == 0) + + if (regexec(regex, text, G_N_ELEMENTS(regex_matches), regex_matches, flags) == 0) { setptr(regex_match_text, get_regex_match_string(text, regex_matches, 0)); return regex_matches[0].rm_so + pos;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.