SF.net SVN: geany: [1109] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Sun Dec 17 17:13:46 UTC 2006
Revision: 1109
http://svn.sourceforge.net/geany/?rev=1109&view=rev
Author: ntrel
Date: 2006-12-17 09:13:46 -0800 (Sun, 17 Dec 2006)
Log Message:
-----------
Don't log 'replaced 0 occurrences' status messages.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-12-17 16:47:08 UTC (rev 1108)
+++ trunk/ChangeLog 2006-12-17 17:13:46 UTC (rev 1109)
@@ -2,6 +2,8 @@
* src/search.c:
Fix using the current word on first use of the Find in Files dialog.
+ * src/document.c:
+ Don't log 'replaced 0 occurrences' status messages.
2006-12-16 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2006-12-17 16:47:08 UTC (rev 1108)
+++ trunk/src/document.c 2006-12-17 17:13:46 UTC (rev 1109)
@@ -1113,6 +1113,37 @@
}
+static void show_replace_summary(gint idx, gint count, const gchar *find_text,
+ const gchar *replace_text, gboolean escaped_chars)
+{
+ gchar *escaped_find_text, *escaped_replace_text, *filename;
+
+ if (count == 0)
+ {
+ ui_set_statusbar("%s", _("No matches found."));
+ return;
+ }
+
+ filename = g_path_get_basename(DOC_FILENAME(idx));
+
+ if (escaped_chars)
+ { // escape special characters for showing
+ escaped_find_text = g_strescape(find_text, NULL);
+ escaped_replace_text = g_strescape(replace_text, NULL);
+ msgwin_status_add(_("%s: replaced %d occurrences of \"%s\" with \"%s\"."),
+ filename, count, escaped_find_text, escaped_replace_text);
+ g_free(escaped_find_text);
+ g_free(escaped_replace_text);
+ }
+ else
+ {
+ msgwin_status_add(_("%s: replaced %d occurrences of \"%s\" with \"%s\"."),
+ filename, count, find_text, replace_text);
+ }
+ g_free(filename);
+}
+
+
/* Returns -1 if no text found or the new range endpoint after replacing. */
static gint
document_replace_range(gint idx, const gchar *find_text, const gchar *replace_text,
@@ -1122,7 +1153,6 @@
gint count = 0;
gint find_len = 0, replace_len = 0;
gboolean match_found = FALSE;
- gchar *escaped_find_text, *escaped_replace_text, *filename;
struct TextToFind ttf;
g_return_val_if_fail(find_text != NULL && replace_text != NULL, FALSE);
@@ -1156,24 +1186,8 @@
}
sci_end_undo_action(doc_list[idx].sci);
- filename = g_path_get_basename(DOC_FILENAME(idx));
+ show_replace_summary(idx, count, find_text, replace_text, escaped_chars);
- if (escaped_chars)
- { // escape special characters for showing
- escaped_find_text = g_strescape(find_text, NULL);
- escaped_replace_text = g_strescape(replace_text, NULL);
- msgwin_status_add(_("%s: replaced %d occurrences of \"%s\" with \"%s\"."),
- filename, count, escaped_find_text, escaped_replace_text);
- g_free(escaped_find_text);
- g_free(escaped_replace_text);
- }
- else
- {
- msgwin_status_add(_("%s: replaced %d occurrences of \"%s\" with \"%s\"."),
- filename, count, find_text, replace_text);
- }
- g_free(filename);
-
if (match_found)
{
// scroll last match in view.
@@ -1181,7 +1195,7 @@
return end;
}
else
- return -1; //no text was found
+ return -1; // no text was found
}
@@ -1204,10 +1218,13 @@
selection_end = document_replace_range(idx, find_text, replace_text, flags,
selection_start, selection_end, escaped_chars);
if (selection_end == -1)
+ {
+ // no replacements
utils_beep();
+ }
else
{
- //update the selection for the new endpoint
+ // update the selection for the new endpoint
sci_set_selection_start(doc_list[idx].sci, selection_start);
sci_set_selection_end(doc_list[idx].sci, selection_end);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list