GNOME Bugzilla – Bug 304056
Default shortcut for '^' not intuitive?
Last modified: 2005-05-16 16:16:57 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).]"
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.
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.
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).
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.