[gcalctool] Clear display on number entry after result



commit 234e0b83b9708f9c28914bfb1d43aa998e267df7
Author: Robert Ancell <robert ancell gmail com>
Date:   Wed Apr 14 23:32:36 2010 +0800

    Clear display on number entry after result

 src/math-equation.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/math-equation.c b/src/math-equation.c
index 813de90..996b239 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -1377,6 +1377,17 @@ pre_insert_text_cb (MathEquation  *equation,
                     gint           len,
                     gpointer       user_data)
 {
+    gunichar c;
+
+    /* Clear result on next digit entered if cursor at end of line */
+    // FIXME Cursor
+    c = g_utf8_get_char(text);
+    if (g_unichar_isdigit(c) && math_equation_is_result(equation)) {
+        gtk_text_buffer_set_text(GTK_TEXT_BUFFER(equation), "", -1);
+        clear_ans(equation, FALSE);
+        gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(equation), location);
+    }
+
     if (equation->priv->ans_start) {
         gint ans_start, ans_end;
         gint offset;



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