[gcalctool] Remove trailing whitespace when entering super-/subscript mode (#631988)



commit 8c7fa1d3ea91747217ee85174fae64e0b7b4b058
Author: Robin Sonefors <ozamosi flukkost nu>
Date:   Tue Oct 12 22:02:16 2010 +0200

    Remove trailing whitespace when entering super-/subscript mode (#631988)

 src/math-buttons.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/math-buttons.c b/src/math-buttons.c
index b8caff4..de82728 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -1735,10 +1735,14 @@ G_MODULE_EXPORT
 void
 set_superscript_cb(GtkWidget *widget, MathButtons *buttons)
 {
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-       math_equation_set_number_mode(buttons->priv->equation, SUPERSCRIPT);
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+        char* display;
+        math_equation_set_number_mode(buttons->priv->equation, SUPERSCRIPT);
+        display = math_equation_get_display(buttons->priv->equation);
+        math_equation_set(buttons->priv->equation, g_strchomp(display));
+    }
     else if (math_equation_get_number_mode(buttons->priv->equation) == SUPERSCRIPT)
-       math_equation_set_number_mode(buttons->priv->equation, NORMAL);
+        math_equation_set_number_mode(buttons->priv->equation, NORMAL);
 }
 
 
@@ -1747,10 +1751,14 @@ G_MODULE_EXPORT
 void
 set_subscript_cb(GtkWidget *widget, MathButtons *buttons)
 {
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-       math_equation_set_number_mode(buttons->priv->equation, SUBSCRIPT);
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+        char* display;
+        math_equation_set_number_mode(buttons->priv->equation, SUBSCRIPT);
+        display = math_equation_get_display(buttons->priv->equation);
+        math_equation_set(buttons->priv->equation, g_strchomp(display));
+    }
     else if (math_equation_get_number_mode(buttons->priv->equation) == SUBSCRIPT)
-       math_equation_set_number_mode(buttons->priv->equation, NORMAL);
+        math_equation_set_number_mode(buttons->priv->equation, NORMAL);
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]