Updating branch refs/heads/master
to fe666120450ea8df11059d60c0bcdb806d3d5426 (commit)
from 7b33a930bf6efc2c879dbb304e6ee0fd4adb2b5a (commit)
commit fe666120450ea8df11059d60c0bcdb806d3d5426
Author: Nick Schermer <[email protected]>
Date: Fri Apr 6 19:06:59 2007 +0000
* mousepad/mousepad-document.c: Fix segfault from previous commit.
* mousepad/mousepad-document.c: Fix bug in searching backwards, we have
to
jump one iter backwards before searching, because we start with the
character right from the first iter. Also removed the equal check
because
it's not needed and only causing problems with backwards searching on
the
first character in the buffer.
(Old svn revision: 25405)
ChangeLog | 9 ++++++++
mousepad/mousepad-document.c | 47 +++++++++++++++--------------------------
2 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6102442..f4f4ef9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
2007-04-06 Nick Schermer <[email protected]>
+ * mousepad/mousepad-document.c: Fix segfault from previous commit.
+ * mousepad/mousepad-document.c: Fix bug in searching backwards, we have
to
+ jump one iter backwards before searching, because we start with the
+ character right from the first iter. Also removed the equal check
because
+ it's not needed and only causing problems with backwards searching on
the
+ first character in the buffer.
+
+
+2007-04-06 Nick Schermer <[email protected]>
* mousepad/mousepad-window.c: Fix opening recent files that do not
exist.
* mousepad/mousepad-window.c, mousepad/mousepad-document.c: Update the
window
title correctly and remove the unused notify::title signals.
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index f64d418..5802f1c 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -68,7 +68,6 @@ static gboolean mousepad_document_iter_search
(const GtkTextIter
MousepadSearchFlags flags,
GtkTextIter
*match_start,
GtkTextIter
*match_end,
- const GtkTextIter
*limit,
gboolean
forward_search);
static void mousepad_document_update_tab (MousepadDocument
*document);
static void mousepad_document_tab_button_clicked (GtkWidget
*widget,
@@ -473,7 +472,8 @@ mousepad_document_set_filename (MousepadDocument *document,
document->display_name = g_filename_display_basename (filename);
/* update the tab label and tooltip */
- mousepad_document_update_tab (document);
+ if (document->ebox && document->label)
+ mousepad_document_update_tab (document);
}
@@ -598,7 +598,6 @@ mousepad_document_iter_search (const GtkTextIter *start,
MousepadSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
- const GtkTextIter *limit,
gboolean search_forward)
{
GtkTextIter iter, begin;
@@ -608,7 +607,6 @@ mousepad_document_iter_search (const GtkTextIter *start,
guint str_offset = 0;
_mousepad_return_val_if_fail (start != NULL, FALSE);
- _mousepad_return_val_if_fail (limit != NULL, FALSE);
/* set the start iter */
iter = *start;
@@ -616,10 +614,6 @@ mousepad_document_iter_search (const GtkTextIter *start,
/* walk from the start to the end iter */
do
{
- /* break when we hit the search limit */
- if (G_UNLIKELY (gtk_text_iter_equal (&iter, limit)))
- break;
-
/* get the characters we're going to compare */
iter_char = gtk_text_iter_get_char (&iter);
str_char = g_utf8_get_char (str);
@@ -694,7 +688,7 @@ mousepad_document_find (MousepadDocument *document,
GtkTextIter doc_start, doc_end;
GtkTextIter sel_start, sel_end;
GtkTextIter match_start, match_end;
- GtkTextIter start, end;
+ GtkTextIter start;
_mousepad_return_val_if_fail (MOUSEPAD_IS_DOCUMENT (document), FALSE);
_mousepad_return_val_if_fail (GTK_IS_TEXT_BUFFER (document->buffer), FALSE);
@@ -708,28 +702,27 @@ mousepad_document_find (MousepadDocument *document,
if (flags & MOUSEPAD_SEARCH_FORWARDS)
{
start = sel_end;
- end = doc_end;
}
- else if (flags & MOUSEPAD_SEARCH_BACKWARDS)
+ else
{
start = sel_start;
- end = doc_start;
- /* reverse the search string */
- reversed = g_utf8_strreverse (string, -1);
- }
- else /* type-ahead */
- {
- start = sel_start;
- end = doc_end;
+ if (flags & MOUSEPAD_SEARCH_BACKWARDS)
+ {
+ /* the character is right of the iter, go one iter backwards */
+ gtk_text_iter_backward_char (&start);
+
+ /* reverse the search string */
+ reversed = g_utf8_strreverse (string, -1);
+ }
}
search:
/* try to find the next occurence of the string */
if (flags & MOUSEPAD_SEARCH_BACKWARDS)
- found = mousepad_document_iter_search (&start, reversed, flags,
&match_start, &match_end, &end, FALSE);
+ found = mousepad_document_iter_search (&start, reversed, flags,
&match_start, &match_end, FALSE);
else
- found = mousepad_document_iter_search (&start, string, flags,
&match_start, &match_end, &end, TRUE);
+ found = mousepad_document_iter_search (&start, string, flags,
&match_start, &match_end, TRUE);
/* select the occurence */
if (found)
@@ -748,15 +741,9 @@ search:
{
/* set the new start and end iter */
if (flags & MOUSEPAD_SEARCH_BACKWARDS)
- {
- end = start;
- start = doc_end;
- }
+ start = doc_end;
else
- {
- end = start;
- start = doc_start;
- }
+ start = doc_start;
/* set we did the wrap, so we don't end up in a loop */
already_wrapped = TRUE;
@@ -818,7 +805,7 @@ mousepad_document_highlight_all (MousepadDocument
*document,
do
{
/* search for the next occurence of the string */
- found = mousepad_document_iter_search (&iter, string, flags,
&match_start, &match_end, &doc_end, TRUE);
+ found = mousepad_document_iter_search (&iter, string, flags,
&match_start, &match_end, TRUE);
if (G_LIKELY (found))
{
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits