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 662451 - Calculate the result when the = key is pressed
Calculate the result when the = key is pressed
Status: RESOLVED OBSOLETE
Product: gnome-calculator
Classification: Core
Component: general
6.2.x
Other Linux
: Normal normal
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-22 11:51 UTC by Robert Roth
Modified: 2018-05-22 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Solve the result on pressing '=' also. (603 bytes, patch)
2012-04-06 19:14 UTC, Pranav Kant
needs-work Details | Review

Description Robert Roth 2011-10-22 11:51:03 UTC
When I use a mouse pointer to do 2+2= I get 4, but when I use a keyboard I get 2+2= typed in the entry field. In basic mode (default), I expect normal calculator behaviour, not algebraic behaviour. After this, you have to press Enter to display the result.

The expected result would be to display the result when pressing the = key, just as when you press the Enter key.
Comment 1 Pranav Kant 2012-04-06 19:14:04 UTC
Created attachment 211504 [details] [review]
Solve the result on pressing '=' also.

This is my first patch. I may be wrong in my approach, please let me know in all such cases.
Comment 2 Robert Roth 2012-04-06 20:18:40 UTC
Review of attachment 211504 [details] [review]:

Simple and to the point, it seems correct.
Comment 3 Robert Ancell 2012-04-07 03:00:53 UTC
For this to work you must
Comment 4 Robert Ancell 2012-04-07 03:04:52 UTC
For this to work you can't always solve when = is pressed - there are valid mathematical equations that gcalctool supports that require the '=', e.g.
a=1

But, it you can probably solve using = if the display is not a valid variable name, e.g.
1+2=
is unambiguously solvable (since we don't support arbitrary algebraic equations)

Note the behaviour should be the same in all modes because it's not clear to the user that the behaviour should change between basic and advanced and this would lead to confusion.
Comment 5 Robert Ancell 2012-04-07 03:06:08 UTC
Review of attachment 211504 [details] [review]:

This only works with the keypad = and not the normal = key.  Also note the comments in the main bug - this would break entering variables.
Comment 6 Tobias Mueller 2016-09-18 03:44:05 UTC
Would attempting to solve when the user types "==" make it easier to implement this?
Comment 7 Robert Roth 2016-09-18 04:58:23 UTC
(In reply to Tobias Mueller from comment #6)
> Would attempting to solve when the user types "==" make it easier to
> implement this?

Implementation might be easier (although I'm not sure on that either), but we would still have an inconsistency between typing on the keyboard or pressing the buttons. As such, I would prefer Robert's solution from comment 4: if the display is not a variable name and the left-side of the = sign is unambiguously solvable, calculate the result. I will take a look at the code to see if I can implement that.
Comment 8 Robert Roth 2016-10-11 08:25:18 UTC
Adding Allan Day to provide a bit of design feedback here as:
* gnome-calculator is not a document-based application, so based on the current HIG, the window title should be the application name
* however, if we consider calculations "documents", the last result can be of immediate use for the user, so this might be ok to show in the window title.
Comment 9 Robert Roth 2016-10-11 08:27:12 UTC
My previous comment was meant for bug 527754, sorry for the noise. 
@Allan Day, no design feedback needed here, please remove yourself from CC, as I can't undo my action of adding you.
Comment 10 GNOME Infrastructure Team 2018-05-22 11:47:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-calculator/issues/22.