[gnome-calculator] Fix TextBuffer iterator error in base conversion.
- From: Arth Patel <arthpatel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fix TextBuffer iterator error in base conversion.
- Date: Tue, 18 Jun 2013 13:53:06 +0000 (UTC)
commit 11cf691e7743fc32f992058b8755f9dd084c37ca
Author: PioneerAxon <arth svnit gmail com>
Date: Tue Jun 18 19:17:08 2013 +0530
Fix TextBuffer iterator error in base conversion.
Thanks githlar gmail com for pointing out the cause of the error.
See Bug# 702356 for more details.
src/math-equation.vala | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/math-equation.vala b/src/math-equation.vala
index ad39671..b97eae6 100644
--- a/src/math-equation.vala
+++ b/src/math-equation.vala
@@ -226,24 +226,18 @@ public class MathEquation : Gtk.TextBuffer
get_iter_at_mark (out ans_end, ans_end_mark);
var orig_ans_text = get_text (ans_start, ans_end, false);
- serializer.set_representation_base (state.ans_base);
var ans_text = serializer.to_string (state.ans);
- serializer.set_representation_base (serializer.get_base ());
+
if (orig_ans_text != ans_text)
{
in_undo_operation = true;
in_reformat = true;
- var start = ans_start.get_offset ();
@delete (ref ans_start, ref ans_end);
+ get_iter_at_mark (out ans_start, ans_start_mark);
+ get_iter_at_mark (out ans_end, ans_end_mark);
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);
-
in_reformat = false;
in_undo_operation = false;
}
@@ -578,10 +572,11 @@ public class MathEquation : Gtk.TextBuffer
get { return serializer.get_base (); }
set
{
- if (serializer.get_base () == value)
+ if (serializer.get_base () == value && serializer.get_representation_base () == value)
return;
serializer.set_base (value);
+ serializer.set_representation_base (value);
reformat_display ();
notify_property ("number-base");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]