[gcalctool] Fix bug where inserting text in locales without thousands separators replaces the whole display (Rob



commit 4871003ef92e5927d61380902633bebc6ed1296d
Author: Robert Ancell <robert ancell gmail com>
Date:   Tue Jul 28 10:00:21 2009 +1000

    Fix bug where inserting text in locales without thousands separators replaces the whole display (Robert Ancell)

 ChangeLog     |    2 ++
 src/display.c |    4 ++--
 src/gtk.c     |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d92f4ca..dac1a41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ gcalctool change history.
       NEWS:
       configure.in:
       Released a gcalctool v5.27.5 tarball.
+    * Fix bug where inserting text in locales without thousands separators
+      replaces the whole display (Robert Ancell)
 
 2009-07-27 Robert Ancell <robert ancell gmail com>
 
diff --git a/src/display.c b/src/display.c
index 5887497..fbad570 100644
--- a/src/display.c
+++ b/src/display.c
@@ -474,7 +474,7 @@ display_insert(GCDisplay *display, int cursor_start, int cursor_end, const char
                 use = FALSE;
             
             /* Ignore thousands separators */
-            if (strncmp(c, v->tsep, strlen(v->tsep)) == 0)
+            if (v->tsep[0] != '\0' && strncmp(c, v->tsep, strlen(v->tsep)) == 0)
                 use = FALSE;
             
             /* Copy existing text */
@@ -540,7 +540,7 @@ display_backspace(GCDisplay *display, int cursor_start, int cursor_end)
                 }
             }
         }
-
+        
         display_insert(display, len - 1, len, "");
     } else if (cursor_start != cursor_end) {
         display_insert(display, cursor_start, cursor_end, "");
diff --git a/src/gtk.c b/src/gtk.c
index 8a54b7d..b01bb3b 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -2187,7 +2187,7 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event)
                     button_widgets[i].function)
                     do_button(button_widgets[i].function, 0);
                 else
-                   button_cb(button, NULL);
+                    button_cb(button, NULL);
                 return TRUE;
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]