After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 524602 - numbers go missing when you press '='
numbers go missing when you press '='
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
5.22.x
Other All
: High major
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
: 527768 538765 544142 (view as bug list)
Depends on: 482688
Blocks:
 
 
Reported: 2008-03-27 06:08 UTC by Daniel James
Modified: 2008-07-22 15:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
screenshot request by Robert (56.42 KB, image/png)
2008-04-15 17:29 UTC, Joanmarie Diggs (IRC: joanie)
  Details
Hack to prevent this happening. (599 bytes, patch)
2008-06-13 17:47 UTC, Rich Burridge
rejected Details | Review

Description Daniel James 2008-03-27 06:08:13 UTC
Please describe the problem:
If you add a lot of numbers together, the calculator will display a scroll bar in the 'output' field. If you press enter, the scrollbar vanishes, but the numbers will not display correctly - it looks as if the window is still scrolled. You can fix it by resizing the program

Steps to reproduce:
1. type: 23+45+234+234+342+453+453+34534+345+345 - make sure that this goes past the boundary of the 'output' field
2. press '='

Actual results:
Numbers vanish or are displayed off to the right of the field. This can be dangerous it can appear to be functioning correctly but be missing digits.

Expected results:
nothing unusual

Does this happen every time?
every

Other information:
Comment 1 Rich Burridge 2008-03-27 14:43:46 UTC
Confirmed.

A workaround (albeit an ugly one) is to maximize the gcalctool window
before entering calculations.

I also wonder whether this is related to bug #482688
Comment 2 Joanmarie Diggs (IRC: joanie) 2008-04-12 19:31:54 UTC
*** Bug 527768 has been marked as a duplicate of this bug. ***
Comment 3 Robert Ancell 2008-04-13 08:49:49 UTC
We were scrolling further than maximum by not taking into account page size:
http://library.gnome.org/devel/gtk/2.12/GtkAdjustment.html#gtk-adjustment-set-value

Fixed in 2.22.2:
http://svn.gnome.org/viewvc/gcalctool?view=revision&revision=2076
Comment 4 Joanmarie Diggs (IRC: joanie) 2008-04-13 17:48:45 UTC
Robert, I just pulled a fresh copy of gcalctool from trunk and can still reproduce this problem.  Any idea what I'm doing wrong?  Thanks!
Comment 5 Robert Ancell 2008-04-15 06:48:29 UTC
Joan, what version of GTK+ do you have? Check the change is present in your local copy (see below) and if it still occurs after a make clean can you attach a screenshot please. I won't be back at my dev box for a few days but I'll have a look then.

Confirmed the change is also on the trunk:
http://svn.gnome.org/viewvc/gcalctool?view=revision&revision=2077
Comment 6 Joanmarie Diggs (IRC: joanie) 2008-04-15 17:29:48 UTC
Created attachment 109320 [details]
screenshot request by Robert

(In reply to comment #5)
> what version of GTK+ do you have? 

Because I use Ubuntu Hardy (fully up-to-date), it was version 2.12.9.  However, because I thought there might be a difference were I to very latest from trunk, it's now version 2.13.1.  No difference.

> Check the change is present in your local copy (see below)

jd@gumby:~/gcalctool$ svn update
At revision 2077.

> and if it still occurs after a make clean

Yup, still does.  And not just after a make clean; I completely deleted my gcalctool svn dir and pulled a fresh copy of trunk just to be darned sure there weren't any old files mucking with things.

> can you attach a screenshot please. 

Done.  Three actually.  The top screenshot was taken just before I pressed =.  The middle was taken immediately after I pressed =.  The bottom was taken after I enlarged the gcalctool window just a smidge.

> I won't be back at my dev box for a few days but I'll have a look then.

I do appreciate it.  Now that I know the workaround (and have recovered from my last-minute-tax-pre-prep "where'd all my numbers go?!?" heart attack *grin*), I'm in no hurry. :-) 

Thanks Robert!
Comment 7 Robert Ancell 2008-04-20 08:54:16 UTC
Hmmm, I can't reproduce this but I'm using GTK+ 2.12.0-1ubuntu3 (Ubuntu Gutsy). Reopening pending investigation in newer GTK+.
Comment 8 Robert Ancell 2008-05-04 03:06:54 UTC
Upgraded to Hardy the other day and can reproduce also. The exact case is:
1) enter '123456789+123456789+123456789+123456789+123456789'
2) press enter
The display is empty.

Again it seems to be a GTK+ problem as if I change the justification to left justify there is no problem.
Comment 9 Rich Burridge 2008-06-13 17:47:45 UTC
Created attachment 112695 [details] [review]
Hack to prevent this happening.

This really is an ugly bug.

I found that by commenting out a section of code in ui_set_display()
that I prevented the problem from happening. I'm not exactly sure
what side-effect doing this has (it all looked the same to me), but 
if it's not too big a deal, I suggest making this change (or something
similar) for the next gcalctool release on Monday.
Comment 10 Joanmarie Diggs (IRC: joanie) 2008-06-13 18:51:57 UTC
> This really is an ugly bug.

"ugly" is an understatement when you're doing last-minute preparation for your visit to your tax preparer and 12 months of figures disappear. ;-)

I haven't used your patch long enough to comment on whether or not it's side-effect free, but it certainly does solve the reported problem. Thanks!
Comment 11 Rich Burridge 2008-06-13 19:04:54 UTC
Thanks Joanie.

Robert, note that I just #ifdef'ed out the code. If there
really is no side-effect to this "fix", I suggest just
removing the code.

I also *strongly* suggest back-porting it to the last
remaining gcalctool that's allowed for the GNOME 2.22.X
series: 2.22.3 (due on 30th June).

Thanks.
Comment 12 Robert Ancell 2008-06-14 09:23:52 UTC
Unfortunately that code is required as this allows you to edit the display from the middle... To see type a number and then put the cursor in the middle and try and insert numbers.

I've done some more work on GTK+ bug #482688 and can confirm this is a GTK+ problem. I have come up with a workaround though:
http://svn.gnome.org/viewvc/gcalctool?view=revision&revision=2111
http://svn.gnome.org/viewvc/gcalctool?view=revision&revision=2112

Rich, Joan: Can you confirm this removes the problem for you? Note that we still get the right-hand digit not correctly aligned.
Comment 13 Rich Burridge 2008-06-14 15:05:40 UTC
Ugh! :-) But it does seem to work nicely. 

Thanks for looking at this.
Comment 14 Robert Ancell 2008-06-16 23:07:01 UTC
Released in 5.23.4, will be released in 5.22.3
Comment 15 Rich Burridge 2008-06-17 14:50:47 UTC
*** Bug 538765 has been marked as a duplicate of this bug. ***
Comment 16 Rich Burridge 2008-07-22 15:32:46 UTC
*** Bug 544142 has been marked as a duplicate of this bug. ***
Comment 17 Joanmarie Diggs (IRC: joanie) 2008-07-22 15:59:28 UTC
(In reply to comment #14)
> Released in 5.23.4, will be released in 5.22.3
> 

I now have 2.23.4.1 installed and the bulk of the digits are hidden to the right. Thus a result of "259259256" is displayed as "25" with half of the 5 cut off.