From fd118d4b96d7241f7cf6bf8ba0aa3ff68b3cdbb8 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 18 Nov 2007 08:18:49 -0500 Subject: [PATCH] Be more efficient when marking dependent lines for execute Don't reapply tags to them or emit chunk-status-changed --- lib/reinteract/shell_buffer.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/reinteract/shell_buffer.py b/lib/reinteract/shell_buffer.py index e9e2e0b..99a4cd9 100755 --- a/lib/reinteract/shell_buffer.py +++ b/lib/reinteract/shell_buffer.py @@ -57,10 +57,11 @@ class StatementChunk: return changed_lines def mark_for_execute(self): - if self.statement == None: - return - - self.needs_execute = True + if self.statement == None or self.needs_execute: + return False + else: + self.needs_execute = True + return True def compile(self, worksheet): if self.statement != None: @@ -297,16 +298,15 @@ class ShellBuffer(gtk.TextBuffer, Worksheet): def __mark_rest_for_execute(self, start_line): for chunk in self.iterate_chunks(start_line): if isinstance(chunk, StatementChunk): - chunk.mark_for_execute() - - result = self.__find_result(chunk) - if result: - self.__apply_tag_to_chunk(self.__recompute_tag, result) + if chunk.mark_for_execute(): + result = self.__find_result(chunk) + if result: + self.__apply_tag_to_chunk(self.__recompute_tag, result) - self.emit("chunk-status-changed", chunk) - if result: - self.emit("chunk-status-changed", result) - + self.emit("chunk-status-changed", chunk) + if result: + self.emit("chunk-status-changed", result) + def __rescan(self, start_line, end_line, entire_statements_deleted=False): rescan_start = start_line while rescan_start > 0: -- 2.11.4.GIT