Backspace deletes all input

Bug #521038 reported by Ondřej Surý
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gcalctool (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: gcalctool

This is regression from Ubuntu Karmic.

gcalctool started to delete all entered input when backspace is pressed, e.g. if I type 2+1+34+2+1 and press BKSP I get empty input

When downgraded to 5.28.2-0ubuntu1 it deletes just last entered digit, e.g. if I type 2+1+34+2+1 and press BKSP I get "2+1+34+2+".

It's very annoying and makes the calculator almost unusable :-(.

ProblemType: Bug
Architecture: i386
Date: Fri Feb 12 16:39:29 2010
DistroRelease: Ubuntu 10.04
EcryptfsInUse: Yes
Package: gcalctool 5.29.90-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.32-13.18-generic
SourcePackage: gcalctool
Uname: Linux 2.6.32-13-generic i686

Revision history for this message
Ondřej Surý (ondrej) wrote :
Revision history for this message
Monkey (monkey-libre) wrote :

I´ve confirmed this bug. I have this problem each time that I do Backspace. Thank You for making Ubuntu better.

Changed in gcalctool (Ubuntu):
status: New → Confirmed
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I'm not reproducing this, I do the following:
1. Open GCalctool
2. Type: "2+1+34+2+1"
display shows "2+1+34+2+1"
3. Press backspace
display show "2+1+34+2+"

Changed in gcalctool (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
Revision history for this message
Robert Ancell (robert-ancell) wrote :

What language/keyboard layout are you using?

Revision history for this message
Monkey (monkey-libre) wrote :

I´m using Spanish but before I used English.

Revision history for this message
Ondřej Surý (ondrej) wrote :

kbmap used is: us and cz

locale:
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE=cs_CZ.UTF-8
LC_NUMERIC=cs_CZ.UTF-8
LC_TIME=cs_CZ.UTF-8
LC_COLLATE=cs_CZ.UTF-8
LC_MONETARY=cs_CZ.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=cs_CZ.UTF-8
LC_NAME=cs_CZ.UTF-8
LC_ADDRESS=cs_CZ.UTF-8
LC_TELEPHONE=cs_CZ.UTF-8
LC_MEASUREMENT=cs_CZ.UTF-8
LC_IDENTIFICATION=cs_CZ.UTF-8
LC_ALL=

But I get same behaviour when I unset all locale variables.

Are you sure that you have tried 5.29.90-0ubuntu1 (version from lucid)?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Using 5.29.90-0ubuntu1 on latest Lucid, did a fresh install and see the same behaviour. If you guys have some programming experience please download from source and try poking around in src/gtk.c main_window_key_press_cb() and see if you can catch anything going wrong.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

(by same behaviour I mean it's still working correctly for me)

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

I'm experiencing the same bug.
I have a very similar locale as Ondřej Surý, that is LANG,LANGUAGE and LC_MESSAGES set to en_US.UTF-8, but others set to my locale it_IT.UTF-8.

Robert Ancell, can you please see if changing the locale as we did triggers the bug?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

I'm playing around with locales and keyboard layouts but still not reproducing.

Revision history for this message
Nicolò Chieffo (yelo3) wrote : Re: [Bug 521038] Re: Backspace deletes all input

try to put this in ~/.profile

unset LC_ALL
export LANGUAGE="en_US.UTF-8"
export LANG="$LANGUAGE"
export LC_CTYPE="it_IT.UTF-8"
export LC_NUMERIC="it_IT.UTF-8"
export LC_TIME="it_IT.UTF-8"
export LC_COLLATE="it_IT.UTF-8"
export LC_MONETARY="it_IT.UTF-8"
export LC_PAPER="it_IT.UTF-8"
export LC_NAME="it_IT.UTF-8"
export LC_ADDRESS="it_IT.UTF-8"
export LC_TELEPHONE="it_IT.UTF-8"
export LC_MEASUREMENT="it_IT.UTF-8"
export LC_IDENTIFICATION="it_IT.UTF-8"

Revision history for this message
Ondřej Surý (ondrej) wrote :

I don't think it's locale related.

More like xkbmap related.

If you diff src/gtk.c, you'll find out they have added new keyboard shortcuts CTRL-BKSP and SHIFT-DEL to clear whole display. But apparently something is wrong in that function.

Ondrej

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

If so, I have set the keymap to italian, can you try if this triggers the bug?

Revision history for this message
Ondřej Surý (ondrej) wrote :

I have traced it down to display_insert(), so after all it is locale related, see attached patch:

diff -urNap gcalctool-5.29.90~/src/display.c gcalctool-5.29.90/src/display.c
--- gcalctool-5.29.90~/src/display.c 2010-02-09 06:14:11.000000000 +0100
+++ gcalctool-5.29.90/src/display.c 2010-02-19 11:46:38.342465011 +0100
@@ -445,7 +445,7 @@ display_insert(GCDisplay *display, int c
                 use = FALSE;

             /* Ignore thousands separators */
- if (strncmp(c, v->tsep, strlen(v->tsep)) == 0)
+ if (*(v->tsep) && strncmp(c, v->tsep, strlen(v->tsep)) == 0)
                 use = FALSE;

             /* Copy existing text */

Revision history for this message
Ondřej Surý (ondrej) wrote :

BTW you are stripping all thousands separators when cursor_start isn't -1 in display_insert() call.

Revision history for this message
Ondřej Surý (ondrej) wrote :

This bug was reintroduced in 0be7b51e, so maybe better fix is to revert that small change, so it does adhere to your coding standards:

@@ -430,7 +473,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 */

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Thanks Ondřej, fixed in 5.29.91
To reproduce:
1. LC_NUMERIC=it_IT.UTF-8 gcalctool
2. Enter "1234"
3. Press backspace
Expected:
"123" is displayed
Observed:
"" is displayed

Changed in gcalctool (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcalctool - 5.29.91-0ubuntu1

---------------
gcalctool (5.29.91-0ubuntu1) lucid; urgency=low

  * New upstream release:
    * Fix bug where backspace deletes all input in locales with no thousands
      separator (LP: #521038)
    * Make boolean operations work with zero, e.g. "0 XOR 5" (LP: #496235)
    * Don't override space and return when display area not selected
    * Make window non-resizable (LP: #486359) (LP: #501680)
    * Change boolean functions to uppercase (xor -> XOR)
    * Documentation rewritten (LP: #521396)
    * Modernised build system
  * debian/control:
    - Build-depend on gnome-common
    - Remove build-depend on scrollkeeper
  * debian/rules:
    - Run autoreconf on build
    - Don't need to clean /var anymore (no scrollkeeper)
    - Don't need to disable scrollkeeper on build
    - Don't need to delete libparser.a anymore
  * debian/install:
  * debian/links:
  * debian/rules:
    - Install gcalctool.xpm from debian/install
    - Make gnome-calculator man page link in debian/links
  * debian/patches/01_lpi.patch:
    - Updated
  * debian/patches/99_autoconf.patch:
    - Not required, autoconf now run from debian/rules
 -- Robert Ancell <email address hidden> Mon, 22 Feb 2010 11:22:07 +1100

Changed in gcalctool (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.