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 304056 - Default shortcut for '^' not intuitive?
Default shortcut for '^' not intuitive?
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
5.5.x
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2005-05-13 13:55 UTC by Sebastien Bacher
Modified: 2005-05-16 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for the changes needed to calctool.c (1.42 KB, text/plain)
2005-05-16 16:14 UTC, Rich Burridge
Details

Description Sebastien Bacher 2005-05-13 13:55:50 UTC
This bug has been opened here: https://bugzilla.ubuntu.com/10207

"This bug may be needed to be moved upstream.  When a user enters a statement
with exponentiation using the keyboard, instead of seeing the proper "^" in the
statement, they will have entered in "XOr".  Example: "5^2" entered with the
keyboard will become (and be calculated as) "5 XOr 2".  I'm not so sure that
many developers find this handy and for myself and the average user, "^" should
be exponentiation, not an exclusive or.  There seems to be no other sane keycode
for entering in exponentiation from the keyboard.  Even "**" tosses up a
malformed statement error.  This interpretation of the "^" keycode needs to be
changed into the nicely sane default of exponentiation. 
...
The default shortcut for exponentiation is 'y' (as in 'x^y')
...
https://bugzilla.ubuntu.com/attachment.cgi?id=2205
'^' -> calc_xpowy() and 'x' -> calc_xor()
...
Ah, there we go.  It seems that this is a simple three line patch to
lr_parser.y.  I ran the old "ask 10 people" usability test on what button people
use when they plug expressions into their software calculators and it's either
"I use a mouse" or "I hit that carrot/hat/up arrow button".  Maybe it's
a cultural thing but so far, no one has thought that "y" would be something they
would try.  I'm including a patch to switch '^' to calc_xpowy() and 'x' to
calc_xor().  I've triple checked to make sure this doesn't break anything in the
parser.  Feeling silly for making a new patch (and a new comment) for three
lines of work on such a trivial change.  The patch is against the latest CVS
but I doubt the parser has changed much.
[In case someone goes crazy:  "**" should not be used as the new keycode for
exponentiation for a variety of reasons; the most basic of these is that "**"
does not exist as an operator for most users and mathematicians (unless they
happen to be doing some numerical analysis).]"
Comment 1 Rich Burridge 2005-05-13 14:10:16 UTC
Luckily, the shortcut 'x' isn't being used, so this swap can be
done. Note that the patch provided is only half the fix. We'll
need to adjust the shortcuts in the button struct's in calctool.c
as well. Sami, is there any other file in your side of the
calculator code that would need to be changed?

Thanks.
Comment 2 Sami Pietilä 2005-05-13 21:19:37 UTC
Making the change for lr_parser.y changes parser's behavior and changing the
button struct changes the input definitions. Additionally, internationalization
touches only function names. 

I don't see any additional changes are needed. 

I am assuming that the problem occurs only in "no arithmetic precedence" mode.
Comment 3 Rich Burridge 2005-05-16 16:14:35 UTC
Created attachment 46500 [details]
Patch for the changes needed to calctool.c

This is the other side of the fix (needed for non-arithmetic
precedence mode).
Comment 4 Rich Burridge 2005-05-16 16:16:57 UTC
Changes checked into CVS HEAD. Version number in
configure.in bumped to 5.6.13. There will need to
be a change to the online help, but Breda will do
that as a separate bug near GNOME 2.12 release time.