Hello community,
here is the log from the commit of package beaver for openSUSE:Factory
checked in at Mon Aug 23 17:31:02 CEST 2010.
--------
--- beaver/beaver.changes 2010-07-17 18:17:53.000000000 +0200
+++ beaver/beaver.changes 2010-08-22 19:51:22.000000000 +0200
@@ -1,0 +2,13 @@
+Sun Aug 22 17:44:38 UTC 2010 - andrea@opensuse.org
+
+- added beaver-0.4.0-fix-sf3030801.patch and
+ beaver-0.4.0-fix-sf3033684.patch to fix upstream bug regarding
+ syntax highlighting and undo/redo actions
+
+-------------------------------------------------------------------
+Fri Aug 20 22:40:51 UTC 2010 - andrea@opensuse.org
+
+- added beaver-0.4.0-fix-sf3033975.patch to fix sf#3033975
+ (a not freed pointer made beaver crash because of lack of memory)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
beaver-0.4.0-fix-sf3030801.patch
beaver-0.4.0-fix-sf3033684.patch
beaver-0.4.0-fix-sf3033975.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ beaver.spec ++++++
--- /var/tmp/diff_new_pack.dY5bgm/_old 2010-08-23 17:20:26.000000000 +0200
+++ /var/tmp/diff_new_pack.dY5bgm/_new 2010-08-23 17:20:26.000000000 +0200
@@ -21,11 +21,14 @@
Name: beaver
Summary: Beaver is an Early AdVanced EditoR
Version: 0.4.0
-Release: 1
+Release: 2
License: GPLv2
Group: System/GUI/GNOME
Url: http://beaver-editor.sourceforge.net
Source0: %name-%version.tar.bz2
+Patch0: %name-0.4.0-fix-sf3033975.patch
+Patch1: %name-0.4.0-fix-sf3030801.patch
+Patch2: %name-0.4.0-fix-sf3033684.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf automake fdupes gcc gcc-c++ make
BuildRequires: doxygen gtk2-devel pkg-config
@@ -39,6 +42,9 @@
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
export CFLAGS="$RPM_OPT_FLAGS"
++++++ beaver-0.4.0-fix-sf3030801.patch ++++++
m d8c7a96c8a9d0e726895647797e259cf644886b2 Mon Sep 17 00:00:00 2001
From: Trevor "Aelthwin" Brown
From c68b18def488bb19f017607e80fc69ce326c05d8 Mon Sep 17 00:00:00 2001 From: Trevor Aelthwin Brown
Date: Sun, 22 Aug 2010 12:51:02 -0400 Subject: [PATCH] bug #3033684 Enables undo/redo on Search & Replace actions
---
src/search.c | 108 +++++++++++++++++++++++++++++++++----------------------
src/undoredo.c | 12 +++++-
2 files changed, 75 insertions(+), 45 deletions(-)
diff --git a/src/search.c b/src/search.c
index 1b79d9c..3e4e03c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -301,6 +301,7 @@ static void find_replace (GtkButton * button, gpointer data)
{
const gchar *search_text = gtk_entry_get_text (GTK_ENTRY (entry_search));
const gchar *replace_text = gtk_entry_get_text (GTK_ENTRY (entry_replace));
+ gboolean text_found = FALSE;
/* has the search text box some value? if not display message and
* abort */
@@ -314,14 +315,21 @@ static void find_replace (GtkButton * button, gpointer data)
* abort */
if (strcmp (replace_text, "") == 0)
{
- beaver_box_error ("Please provide a replace string!");
- return;
+ if (! beaver_box_question("Empty string provided as a replacement. Do you want to continue?"))
+ {
+ return;
+ }
}
/* do we want to search case sensitive? */
gboolean case_sensitive =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_case_sensitive));
+ // Proceed with the search & replace!
+ // start by getting the page and toggling the user action flag on
+ gint page = gtk_notebook_get_current_page (GTK_NOTEBOOK (MainNotebook));
+ FPROPS (page, WidgetInfo.in_user_action) = TRUE;
+
#ifdef REGEX_SUPPORT
/* should we treat the input as a regex pattern and execute it? */
gboolean regex_mode =
@@ -332,6 +340,7 @@ static void find_replace (GtkButton * button, gpointer data)
beaver_text_replace_regex (search_text, replace_text, case_sensitive,
gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (check_replace_all)));
+ text_found = TRUE; // for now, pretend that text was found @TODO improve
}
else
{
@@ -341,62 +350,75 @@ static void find_replace (GtkButton * button, gpointer data)
(GTK_TOGGLE_BUTTON (check_replace_all)))
{
beaver_text_replace (search_text, replace_text, case_sensitive);
- return;
+ text_found = TRUE; // for now, pretend that text was found @TODO improve
}
-
- /* get the current page that should be edited */
- gint current_page =
- gtk_notebook_get_current_page (GTK_NOTEBOOK (MainNotebook));
-
- /* get the text buffer */
- GtkTextBuffer *buffer = FPROPS (current_page, Buffer);
-
- /* try to load cursors from selection */
- GtkTextIter start, end;
- gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
-
- /* determine where to start */
- gint offset = 0;
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (check_start_cursor)))
+ else
{
- offset = gtk_text_iter_get_offset (&start);
- }
- /* search for the string, if found, then ask the user if
- * he wants to replace this string, if not, then search for the
- * next.
- */
- gint m = strlen (search_text);
- if (beaver_text_find (search_text, offset, case_sensitive))
- {
- /* get the position of the selection */
- BeaverTextSelection *pos = beaver_text_selection_position ();
+ /* get the current page that should be edited */
+ gint current_page =
+ gtk_notebook_get_current_page (GTK_NOTEBOOK (MainNotebook));
+
+ /* get the text buffer */
+ GtkTextBuffer *buffer = FPROPS (current_page, Buffer);
- /* scroll to the selected position */
+ /* try to load cursors from selection */
GtkTextIter start, end;
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
- gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW
- (FPROPS (current_page, Text)), &start,
- 0.1, FALSE, 0, 0);
- /* ask the question! */
- gint answer = beaver_box_question ("Do you want to replace?");
- if (answer)
+ /* determine where to start */
+ gint offset = 0;
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (check_start_cursor)))
{
- gtk_text_buffer_select_range (buffer, &start, &end);
- beaver_text_selection_set (replace_text);
+ offset = gtk_text_iter_get_offset (&start);
}
- /* proceed */
- offset = pos->offset + m;
+ /* search for the string, if found, then ask the user if
+ * he wants to replace this string, if not, then search for the
+ * next.
+ */
+ gint m = strlen (search_text);
+ if (beaver_text_find (search_text, offset, case_sensitive))
+ {
+ /* get the position of the selection */
+ BeaverTextSelection *pos = beaver_text_selection_position ();
+
+ /* scroll to the selected position */
+ GtkTextIter start, end;
+ gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
+ gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW
+ (FPROPS (current_page, Text)), &start,
+ 0.1, FALSE, 0, 0);
- /* free up space */
- g_free (pos);
+ /* ask the question! */
+ gint answer = beaver_box_question ("Do you want to replace?");
+ if (answer)
+ {
+ gtk_text_buffer_select_range (buffer, &start, &end);
+ beaver_text_selection_set (replace_text);
+ }
+
+ /* proceed */
+ offset = pos->offset + m;
+
+ /* free up space */
+ g_free (pos);
+ text_found = TRUE;
+ }
}
#ifdef REGEX_SUPPORT
}
#endif
+
+ // all done... turn the user action flag back off
+ FPROPS (page, WidgetInfo.in_user_action) = FALSE;
+
+ // if no text was found, let the user know instead of just sitting there.
+ if (! text_found)
+ {
+ beaver_box_message ("String not found");
+ }
}
/**
diff --git a/src/undoredo.c b/src/undoredo.c
index 2b087d7..c4b46bd 100644
--- a/src/undoredo.c
+++ b/src/undoredo.c
@@ -38,6 +38,9 @@
#include "undoredo.h"
+//#define DEBUG_UNDOREDO
+
+
extern GtkWidget *MainNotebook;
extern GArray *FileProperties;
extern t_settings Settings;
@@ -142,10 +145,14 @@ END_FCN}
void undoredo_on_delete (GtkTextBuffer * Buffer, GtkTextIter * start_in,
GtkTextIter * end_in, gpointer data)
{
+ START_FCN
gint page = GPOINTER_TO_INT (data);
- START_FCN if (FPROPS (page, WidgetInfo.in_user_action))
+ if (FPROPS (page, WidgetInfo.in_user_action))
{
+#ifdef DEBUG_UNDOREDO
+ g_print (__FILE__ ": %s in_user_action = TRUE\n", __FUNCTION__);
+#endif
t_action *action;
gint start, end;
gchar *text;
@@ -167,7 +174,8 @@ void undoredo_on_delete (GtkTextBuffer * Buffer, GtkTextIter * start_in,
action->toggle_state = FPROPS (page, WidgetInfo.undoredo_toggler);
}
-END_FCN}
+ END_FCN
+}
void record_action (t_action * action)
{
--
1.6.3
++++++ beaver-0.4.0-fix-sf3033975.patch ++++++
m 8f613632c59350329ea044bf9d14f94ee6598305 Mon Sep 17 00:00:00 2001
From: heuripedes