SF.net SVN: geany:[5359] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Nov 2 17:15:22 UTC 2010
Revision: 5359
http://geany.svn.sourceforge.net/geany/?rev=5359&view=rev
Author: ntrel
Date: 2010-11-02 17:15:22 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Don't allow pasting of numbers followed by other characters in the
Go to Line dialog/field (patch by Dimitar Zhekov, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/ui_utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-11-02 17:06:32 UTC (rev 5358)
+++ trunk/ChangeLog 2010-11-02 17:15:22 UTC (rev 5359)
@@ -9,6 +9,9 @@
Rename submenu item labels to be more descriptive.
* src/keybindings.c:
Fix Alt+[0-9] switching tabs when other modifiers are also held.
+ * src/ui_utils.c:
+ Don't allow pasting of numbers followed by other characters in the
+ Go to Line dialog/field (patch by Dimitar Zhekov, thanks).
2010-11-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2010-11-02 17:06:32 UTC (rev 5358)
+++ trunk/src/ui_utils.c 2010-11-02 17:15:22 UTC (rev 5359)
@@ -2439,21 +2439,21 @@
void ui_editable_insert_text_callback(GtkEditable *editable, gchar *new_text,
gint new_text_len, gint *position, gpointer data)
{
- gboolean stop_signal = FALSE;
- const gchar c = *new_text;
+ gboolean first = position != NULL && *position == 0;
+ gint i;
- /* allow inserting '+' and '-' as the first character */
- if (position != NULL && *position == 0)
+ if (new_text_len == -1)
+ new_text_len = strlen(new_text);
+
+ for (i = 0; i < new_text_len; i++, new_text++)
{
- if (c != '+' && c != '-' && ! isdigit(c))
- stop_signal = TRUE;
+ if ((!first || !strchr("+-", *new_text)) && !isdigit(*new_text))
+ {
+ g_signal_stop_emission_by_name(editable, "insert-text");
+ break;
+ }
+ first = FALSE;
}
- /* don't insert any text when it is not a digit */
- else if (! isdigit(c))
- stop_signal = TRUE;
-
- if (stop_signal)
- g_signal_stop_emission_by_name(editable, "insert-text");
}
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