From 60d466a1f458db6739a9e10bf54b9f1399b97621 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 6 Nov 2007 09:34:35 -0500 Subject: [PATCH] Fix a problem when we were unnecessarily calling compute_nr_pos_from_iter() when inserting a multiline result, causing a traceback. --- lib/reinteract/shell_buffer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/reinteract/shell_buffer.py b/lib/reinteract/shell_buffer.py index 4cc2b59..2df0adf 100755 --- a/lib/reinteract/shell_buffer.py +++ b/lib/reinteract/shell_buffer.py @@ -545,7 +545,8 @@ class ShellBuffer(gtk.TextBuffer, Worksheet): if not self.__modifying_results: print "Inserting '%s' at %s" % (text, (location.get_line(), location.get_line_offset())) - start_pos = self.__compute_nr_pos_from_iter(location) + if not self.__modifying_results: + start_pos = self.__compute_nr_pos_from_iter(location) gtk.TextBuffer.do_insert_text(self, location, text, text_len) end_line = location.get_line() @@ -1302,6 +1303,13 @@ if __name__ == '__main__': expect_text("1\n2"); expect([S(0,0), R(1,1), S(2,2), R(3,3)]) + # Calculation resulting in a multi-line result change + clear() + + insert(0, 0, "for i in range(0, 10): print i") + buffer.calculate() + expect([S(0, 0), R(1, 10)]) + # Test deleting a range containing both results and statements clear() -- 2.11.4.GIT