[gnome-calculator] Fix Malformed expression on base change.



commit 9ff8396ca73eaade391acc9eceacc1fcfe774cfc
Author: PioneerAxon <arth svnit gmail com>
Date:   Wed Jun 11 01:57:06 2014 +0530

    Fix Malformed expression on base change.

 src/math-equation.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/math-equation.vala b/src/math-equation.vala
index 2695716..97ee98b 100644
--- a/src/math-equation.vala
+++ b/src/math-equation.vala
@@ -237,6 +237,15 @@ public class MathEquation : Gtk.SourceBuffer
             get_iter_at_mark (out ans_end, ans_end_mark);
             insert_with_tags (ans_end, ans_text, -1, ans_tag);
 
+            // NOTE: Due to the inverted gravity of answer marks, after inserting text
+            //       the positions are inverted. Hence, we need to recreate marks.
+            get_iter_at_mark (out ans_start, ans_start_mark);
+            get_iter_at_mark (out ans_end, ans_end_mark);
+            delete_mark (ans_start_mark);
+            delete_mark (ans_end_mark);
+            ans_start_mark = create_mark (null, ans_end, false);
+            ans_end_mark = create_mark (null, ans_start, true);
+
             in_reformat = false;
             in_undo_operation = false;
         }


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