[gcalctool/vala] Fix changing display properties on answer



commit 6fa53b52c9fcf778ba5e85a1b1b235dd1cdf682c
Author: Robert Ancell <robert ancell canonical com>
Date:   Sat Oct 13 12:41:24 2012 +1300

    Fix changing display properties on answer

 src/math-equation.vala |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/math-equation.vala b/src/math-equation.vala
index a2426c7..fb71326 100644
--- a/src/math-equation.vala
+++ b/src/math-equation.vala
@@ -211,27 +211,24 @@ public class MathEquation : Gtk.TextBuffer
         if (ans_start_mark == null)
             return;
 
-        string orig_ans_text;
-        string ans_text;
         Gtk.TextIter ans_start, ans_end;
-
         get_iter_at_mark (out ans_start, ans_start_mark);
         get_iter_at_mark (out ans_end, ans_end_mark);
-        orig_ans_text = get_text (ans_start, ans_end, false);
-        ans_text = serializer.to_string (state.ans);
+
+        var orig_ans_text = get_text (ans_start, ans_end, false);
+        var ans_text = serializer.to_string (state.ans);
         if (orig_ans_text != ans_text)
         {
-            int start;
-
             in_undo_operation = true;
             in_reformat = true;
 
-            start = ans_start.get_offset ();
+            var start = ans_start.get_offset ();
             @delete (ref ans_start, ref ans_end);
-            insert_with_tags (ans_end, ans_text, -1, ans_tag, null);
+            insert_with_tags (ans_end, ans_text, -1, ans_tag);
 
             /* There seems to be a bug in the marks as they alternate being the correct and incorrect ways.  Reset them */
             get_iter_at_offset (out ans_start, start);
+            get_iter_at_offset (out ans_end, start + ans_text.length);
             move_mark (ans_start_mark, ans_start);
             move_mark (ans_end_mark, ans_end);
 



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