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 695025 - Squaring key adds to exponent instead of squaring
Squaring key adds to exponent instead of squaring
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-02 20:43 UTC by Jeremy Bicha
Modified: 2013-05-19 19:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixed the error :) (721 bytes, patch)
2013-04-27 11:57 UTC, Garima Joshi
needs-work Details | Review
Added superscript notation with space in multiple squaring. (2.78 KB, patch)
2013-05-03 08:33 UTC, Garima Joshi
needs-work Details | Review
Fixed spaces. (2.78 KB, patch)
2013-05-18 20:49 UTC, Garima Joshi
committed Details | Review

Description Jeremy Bicha 2013-03-02 20:43:07 UTC
1. Basic mode
2. Press 3
3. Press squaring key twice
4. Press =

Expected:

Result value is 81.

Actual:

Result value is 31381059609.

Source: http://gfredericks.com/gfrlog/posts/81 and https://bugs.launchpad.net/bugs/1107169
Comment 1 Garima Joshi 2013-04-27 11:57:17 UTC
Created attachment 242653 [details] [review]
Fixed the error :)
Comment 2 PioneerAxon 2013-04-28 21:07:46 UTC
Review of attachment 242653 [details] [review]:

A better way to deal with this would be to add a blank space before appending ² to the equation if there is already a superscript number just before cursor.
Comment 3 Garima Joshi 2013-05-03 08:33:57 UTC
Created attachment 243150 [details] [review]
Added superscript notation with space in multiple squaring.
Comment 4 PioneerAxon 2013-05-18 19:47:25 UTC
Review of attachment 243150 [details] [review]:

Except for code formatting issue, the patch looks great and is ready to be committed.
Can you fix the format as following?
<function_name><space>(<whatever>);
Thank you. :)

::: src/math-equation.vala
@@ +800,3 @@
+
+        /*if it is not the first character in the buffer*/
+        if(iter.backward_char())

Incorrect formatting.

@@ +802,3 @@
+        if(iter.backward_char())
+        {
+            unichar previous_character = iter.get_char();

Incorrect formatting.

@@ +809,3 @@
+        }
+
+        if(space_required)

Incorrect formatting.

@@ +811,3 @@
+        if(space_required)
+        {
+            insert(" ²");

Incorrect formatting.

@@ +815,3 @@
+        else
+        {
+            insert("²");

Incorrect formatting.
Comment 5 Garima Joshi 2013-05-18 20:49:34 UTC
Created attachment 244670 [details] [review]
Fixed spaces.
Comment 6 PioneerAxon 2013-05-19 19:53:05 UTC
Review of attachment 244670 [details] [review]:

Committed..

Thank you. :)