[geany/geany-plugins] aef9af: scope - evaluate expressions with quotes, small changes and fixes

Dimitar Zhekov git-noreply at geany.org
Sun Dec 16 18:28:42 UTC 2012


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Sun, 16 Dec 2012 18:28:42 UTC
Commit:      aef9af98434a81f081b4cc3e078e958185bee6b0
             https://github.com/geany/geany-plugins/commit/aef9af98434a81f081b4cc3e078e958185bee6b0

Log Message:
-----------
scope - evaluate expressions with quotes, small changes and fixes


Modified Paths:
--------------
    scope/ChangeLog
    scope/TODO
    scope/docs/scope.html
    scope/src/break.c
    scope/src/common.h
    scope/src/debug.c
    scope/src/menu.c
    scope/src/menu.h
    scope/src/scope.c
    scope/src/tooltip.c
    scope/src/tooltip.h
    scope/src/views.c
    scope/src/views.h

Modified: scope/ChangeLog
18 files changed, 17 insertions(+), 1 deletions(-)
===================================================================
@@ -1,4 +1,20 @@
-2011-12-13  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
+2012-12-16  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
+
+ * src/common.h, src/menu.h:
+   Fixed forward declarations (though my gcc accepts them).
+ * src/menu.c, src/tooltip.c, src/views.c, src/views.h:
+   Clear scid_gen on program exit. No real risk of overflow,
+   but smaller values look better in Debug Console.
+ * src/menu.c:
+   Position cursor in modify dialog after " = ".
+ * src/tooltip.c:
+   Reset internal variables on program exit.
+ * src/debug.c:
+   Escape "\ in evaluate expressions.
+ * docs/scope.html, src/scope.c:
+   Increased version to 0.77.
+
+2012-12-13  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
 
  * data/scope.glade, src/local.c, src/parse.c, src/parse.h,
    src/stack.c, src/stack.h:


Modified: scope/TODO
2 files changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -1,7 +1,5 @@
 wscript_*
 
-evaluate expressions with quotes
-
 various tests, source code checks etc.
 
 ask user for terminate debugging on build actions


Modified: scope/docs/scope.html
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -670,7 +670,7 @@
 
 <b><a name="copyright">Copyright</a></b>
 
-<p>Scope 0.76, Copyright (C) 2012 Dimitar Toshkov Zhekov</p>
+<p>Scope 0.77, Copyright (C) 2012 Dimitar Toshkov Zhekov</p>
 
 <p>The menu and toolbar icons are from <a href="http://netbeans.org">Netbeans</a>, except for
 BreakPoint.</p>


Modified: scope/src/break.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -237,7 +237,7 @@ static void append_script_command(const ParseNode *node, GString *string)
 	iff (node->type == PT_VALUE, "script: contains array")
 	{
 		gchar *display = utils_get_display_from_7bit((char *) node->value, HB_DEFAULT);
-		gchar *s;
+		const gchar *s;
 
 		if (string->len)
 			g_string_append_c(string, ' ');


Modified: scope/src/common.h
1 files changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -24,7 +24,6 @@
 extern GeanyFunctions *geany_functions;
 
 typedef struct _MenuItem MenuItem;
-typedef enum _ViewIndex ViewIndex;
 
 #include "break.h"
 #include "conterm.h"


Modified: scope/src/debug.c
14 files changed, 13 insertions(+), 1 deletions(-)
===================================================================
@@ -719,7 +719,19 @@ void debug_send_format(gint tf, const char *format, ...)
 char *debug_send_evaluate(char token, gint scid, const gchar *expr)
 {
 	char *locale = utils_get_locale_from_utf8(expr);
-	debug_send_format(F, "0%c%d-data-evaluate-expression \"%s\"", token, scid, locale);
+	GString *string = g_string_sized_new(strlen(locale));
+	const char *s;
+
+	for (s = locale; *s; s++)
+	{
+		if (*s == '"' || *s == '\\')
+			g_string_append_c(string, '\\');
+		g_string_append_c(string, *s);
+	}
+
+	debug_send_format(F, "0%c%d-data-evaluate-expression \"%s\"", token, scid, string->str);
+	g_string_free(string, TRUE);
+
 	return locale;
 }
 


Modified: scope/src/menu.c
8 files changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -334,12 +334,15 @@ static void menu_evaluate_modify(const gchar *expr, const char *value, const gch
 {
 	gchar *display = parse_get_display_from_7bit(value, hb_mode, mr_mode);
 	gchar *text = g_strdup_printf("%s = %s", expr, display ? display : "");
+	GtkTextIter iter;
 
 	g_free(display);
 	gtk_window_set_title(GTK_WINDOW(modify_dialog), title);
 	gtk_widget_grab_focus(modify_value);
 	gtk_text_buffer_set_text(modify_text, text, -1);
 	g_free(text);
+	gtk_text_buffer_get_iter_at_offset(modify_text, &iter, g_utf8_strlen(expr, -1) + 3);
+	gtk_text_buffer_place_cursor(modify_text, &iter);
 	modify_dialog_update_state(debug_state());
 
 	if (gtk_dialog_run(GTK_DIALOG(modify_dialog)) == GTK_RESPONSE_ACCEPT)
@@ -493,6 +496,11 @@ void menu_set_popup_keybindings(guint item)
 	}
 }
 
+void menu_clear(void)
+{
+	scid_gen = 0;
+}
+
 void menu_update_state(DebugState state)
 {
 	if (active_menu)


Modified: scope/src/menu.h
5 files changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -19,14 +19,14 @@
 
 #ifndef MENU_H
 
-typedef struct _MenuItem
+struct _MenuItem
 {
 	const char *name;
 	void (*callback)(const MenuItem *menu_item);
 	guint state;
 	GtkWidget *widget;  /* automatic */
 	gpointer gdata;
-} MenuItem;
+};
 
 typedef struct _MenuInfo
 {
@@ -96,6 +96,7 @@ void menu_mber_button_release(GtkTreeSelection *selection, GtkWidget *item,
 } MenuKey;
 
 void menu_set_popup_keybindings(guint item);
+void menu_clear(void);
 void menu_update_state(DebugState state);
 
 void menu_init(void);


Modified: scope/src/scope.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -32,7 +32,7 @@
 PLUGIN_VERSION_CHECK(215)
 
 PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Scope Debugger"),
-	_("Simple GDB front-end."), "0.76" , "Dimitar Toshkov Zhekov <dimitar.zhekov at gmail.com>")
+	_("Simple GDB front-end."), "0.77" , "Dimitar Toshkov Zhekov <dimitar.zhekov at gmail.com>")
 
 /* Keybinding(s) */
 enum


Modified: scope/src/tooltip.c
7 files changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -177,6 +177,13 @@ void tooltip_remove(GeanyEditor *editor)
 	}
 }
 
+void tooltip_clear(void)
+{
+	scid_gen = 0;
+	last_pos = -1;
+	peek_pos = -1;
+}
+
 gboolean tooltip_update(void)
 {
 	if (option_editor_tooltips)


Modified: scope/src/tooltip.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -24,6 +24,8 @@
 
 void tooltip_attach(GeanyEditor *editor);
 void tooltip_remove(GeanyEditor *editor);
+
+void tooltip_clear(void);
 gboolean tooltip_update(void);
 
 void tooltip_finalize(void);


Modified: scope/src/views.c
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -42,7 +42,8 @@
 	{ FALSE, watches_clear,  watches_update,  TRUE,  DS_DEBUG },
 	{ FALSE, NULL,           dc_update,       FALSE, DS_DEBUG },
 	{ FALSE, inspects_clear, inspects_update, FALSE, DS_DEBUG },
-	{ FALSE, NULL,           tooltip_update,  FALSE, DS_SENDABLE }
+	{ FALSE, tooltip_clear,  tooltip_update,  FALSE, DS_SENDABLE },
+	{ FALSE, menu_clear,     NULL,            FALSE, 0 }
 };
 
 void view_dirty(ViewIndex index)


Modified: scope/src/views.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -30,6 +30,7 @@
 	VIEW_CONSOLE,
 	VIEW_INSPECT,
 	VIEW_TOOLTIP,
+	VIEW_POPMENU,
 	VIEW_COUNT
 } ViewIndex;
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).


More information about the Plugins-Commits mailing list