From: Andrea Zagli Date: Wed, 11 Nov 2009 16:46:32 +0000 (+0100) Subject: Bugfix on gtk_masked_entry_delete_text. X-Git-Tag: v0.0.3~11 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=e4acf3d89e03ca29438b9b19547aab65dfe839fd;p=libgtkmaskedentry Bugfix on gtk_masked_entry_delete_text. --- diff --git a/src/gtkmaskedentry.c b/src/gtkmaskedentry.c index c37584a..b1cd903 100644 --- a/src/gtkmaskedentry.c +++ b/src/gtkmaskedentry.c @@ -1,6 +1,6 @@ /* * GtkMaskedEntry widget for GTK+ - * Copyright (C) 2005-2007 Andrea Zagli + * Copyright (C) 2005-2009 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -350,10 +350,10 @@ gtk_masked_entry_delete_text (GtkEditable *editable, newtext[c] = mask[i]; } } - newtext[c] = '\0'; if (c > 0) { + newtext[c] = '\0'; i = start_pos; g_signal_handlers_block_by_func (editable, (gpointer)gtk_masked_entry_insert_text, user_data); g_signal_handlers_block_by_func (editable, (gpointer)gtk_masked_entry_delete_text, user_data); @@ -419,10 +419,10 @@ gtk_masked_entry_insert_text (GtkEditable *editable, newtext[c++] = (mask[*position + i] == '^' ? toupper (text[i]) : text[i]); } } - newtext[c] = '\0'; if (c > 0) { + newtext[c] = '\0'; g_signal_handlers_block_by_func (editable, (gpointer)gtk_masked_entry_insert_text, user_data); g_signal_handlers_block_by_func (editable, (gpointer)gtk_masked_entry_delete_text, user_data); gtk_editable_delete_text (editable, *position, *position + c); diff --git a/tests/masked_entry.c b/tests/masked_entry.c index 59d665c..9462dd7 100644 --- a/tests/masked_entry.c +++ b/tests/masked_entry.c @@ -1,6 +1,6 @@ /* * GtkMaskedEntry widget test - * Copyright (C) 2005 Andrea Zagli + * Copyright (C) 2005-2009 Andrea Zagli * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -184,11 +184,11 @@ main (int argc, char **argv) label = gtk_label_new ("Set value"); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, 0, 0, 3, 3); gtk_widget_show (label); - + txtValueNew = gtk_entry_new (); gtk_table_attach (GTK_TABLE (table), txtValueNew, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 3, 3); gtk_widget_show (txtValueNew); - + btnValueNew = gtk_button_new_with_label ("Set"); gtk_table_attach (GTK_TABLE (table), btnValueNew, 2, 3, 4, 5, 0, 0, 3, 3); gtk_widget_show (btnValueNew); @@ -220,7 +220,7 @@ main (int argc, char **argv) rend = gtk_cell_renderer_masked_new (); g_object_set (rend, "editable", TRUE, NULL); g_signal_connect (rend, "edited", - G_CALLBACK (on_cell_edited), NULL); + G_CALLBACK (on_cell_edited), NULL); col = gtk_tree_view_column_new_with_attributes ("Masked", rend,