GNOME Bugzilla – Bug 455889
Copy/paste of lower case hex letter does not work
Last modified: 2007-09-28 18:11:00 UTC
patch to ce_tokeniser.l Other information:
Created attachment 91621 [details] [review] modified ce_tokeniser.l
Not a bug. It's deliberate. Most of the lower-case keyboard short-cuts are used for other commands: [a] - Set accuracy [c] - Change sign [d] - Double-declining depreciation [e] - Enter an exponential number [f] - User-defined functions
Yes for sure, most a-z lower letter are used for keyboard shortcuts. It could be unpleasant if you don't know that you have to type hexa characters in Upper case. But i'm not talking about typing, but about pasting. On paste lower-case letter aren't pass as a command, they are directly pasted in the field. This patch is to made copy/paste usable from a tool like objdump, gdb,... to gcalctool for calculus on address.
Ah, thanks for the clarification. I'll let Sami, (the author of the arithmetic precedence code in gcalctool) evaluate it further.
Lower case hex symbols are not allowed in gcalctool because of ambiguous cases they would create: "e" is actually reserved for neper's number if it is not used in xey, in which case it is x*10^y. I think the patch, as a such, can not be checked in. The problem seems to be more complicated than the suggested solution.
Ok, i see the problem. There is probably no direct solution. Maybe a mode with inverted lower and upper ? where 1e+10 becomes 1E+10
Here's the comment I sent Sami in email: "One possible solution is to change the existing a-f gcalctool definitions to be control-[a-f] as their shortcuts. Then, if we have a buffer being pasted in, we automatically take a-f or A-F to be hex digits. That still leaves fixing up recognizing e in scientific numbers. I like your idea of "e^". It might work. We should think about it more for gcalctool in the next GNOME (2.21/22) release."
Here is a quote from a email I sent to Rich: "I guess the only way to support lower case hex symbols is to define non-ambiguous syntax, which has lower (and upper) case hex symbols."
There is now a proposed solution to this for gcalctool for GNOME 2.21/22. There are two currently open bugs involved here: http://bugzilla.gnome.org/show_bug.cgi?id=455889 http://bugzilla.gnome.org/show_bug.cgi?id=469245 (and an old one - bug #118826). Before 24th September 2003, hexadecimal input used to be "a" - "f". This was changed to "A" - "F" because of bug #118826 http://bugzilla.gnome.org/show_bug.cgi?id=118826 The plan now is to change them back to "a" - "f". There are a set of other functions where the keyboard shortcut will be reverted to their original (pre Sept 2003) upper case values: [A] - Set accuracy [C] - Change sign [D] - Double-declining depreciation [E] - Enter an exponential number [F] - User-defined functions With copy/paste operations, where the user is pasting a string into gcalctool, the copy buffer will be iterated over. If an "A", "B", "C", "D" or "F" character is encountered, it will be converted to its lowercase equivalent. If an "E" is found, and the next character is a "-" or a "+", then it remains as an upper case "E" (it's assumed to be a possible exponential number), otherwise its converted to a lower case "e". Displaying of hex digits in the gcalctool display should still be in uppercase. Displaying of the "e" in an exponential number should still be in lower-case. In both left-to-right precedence and arithmetic precedence modes, if the user tries to enter a numeric digit that is incorrect for the current numeric base, then this shouldn't be allowed. This is already the case for left-to-right precedence. The gcalctool documentation (and tooltips) will be updated to reflect these changes. I think that covers everything raised in bug #455889 and bug #469245. If I've missed anything, or you see any problem with this proposed solution, please let me know. When the gcalctool 5.20.0 release is out the way, and the code has been branched, I'll start looking at what's needed to make these changes.
Work to try to fix this bug is part of the current patch(es) to bug #469245.
The fix for bug #469245 has been checked in. See: http://bugzilla.gnome.org/show_bug.cgi?id=469245#c15 for more details. Closing this bug as FIXED. If you find and problems or have any further comments, please add them to bug #469245. Thanks.