Remove unnecessary try
@@ -812,7 +812,6 @@ class EnhancedTextWithLogging(tktextext.EnhancedText):
self._last_event_changed_line_count = False
def direct_insert(self, index, chars, tags=None, **kw):
- try:
# try removing line numbers
# TODO: shouldn't it take place only on paste?
# TODO: does it occur when opening a file with line numbers in it?
@@ -822,8 +821,7 @@ class EnhancedTextWithLogging(tktextext.EnhancedText):
concrete_index = self.index(index)
line_before = self.get(concrete_index + " linestart", concrete_index + " lineend")
self._last_event_changed_line_count = "\n" in chars
- return tktextext.EnhancedText.direct_insert(self, index, chars, tags=tags, **kw)
- finally:
+ result = tktextext.EnhancedText.direct_insert(self, index, chars, tags=tags, **kw)
line_after = self.get(concrete_index + " linestart", concrete_index + " lineend")
trivial_for_coloring, trivial_for_parens = self._is_trivial_edit(
chars, line_before, line_after
@@ -837,6 +835,7 @@ class EnhancedTextWithLogging(tktextext.EnhancedText):
trivial_for_coloring=trivial_for_coloring,
trivial_for_parens=trivial_for_parens,
)
+ return result
def direct_delete(self, index1, index2=None, **kw):
try:
