From cf17104be88d5bfa05787762777cf9227a3f1953 Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Tue, 13 Feb 2024 03:16:06 +0100 Subject: [PATCH] remove unneccacary try-catcj --- cat_win/util/editor.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cat_win/util/editor.py b/cat_win/util/editor.py index 4d0d5d16..a584eb1c 100644 --- a/cat_win/util/editor.py +++ b/cat_win/util/editor.py @@ -735,25 +735,25 @@ def _render_scr(self) -> None: # display screen for row in range(max_y): brow = row + self.wpos.row + if brow >= len(self.window_content): + self.curse_window.clrtobot() + break for col in range(max_x): bcol = col + self.wpos.col - if brow >= len(self.window_content) or bcol >= len(self.window_content[brow]): - break - try: - cur_char = self.window_content[brow][bcol] - if cur_char == '\t': - self.curse_window.addch(row, col, '>', - self._get_color(4)) - elif not cur_char.isprintable(): - self.curse_window.addch(row, col, self._get_special_char(cur_char), - self._get_color(5)) - elif self.window_content[brow][bcol:].isspace(): - self.curse_window.addch(row, col, cur_char, - self._get_color(3)) - else: - self.curse_window.addch(row, col, cur_char) - except curses.error: + if bcol >= len(self.window_content[brow]): break + cur_char = self.window_content[brow][bcol] + if cur_char == '\t': + self.curse_window.addch(row, col, '>', + self._get_color(4)) + elif not cur_char.isprintable(): + self.curse_window.addch(row, col, self._get_special_char(cur_char), + self._get_color(5)) + elif self.window_content[brow][bcol:].isspace(): + self.curse_window.addch(row, col, cur_char, + self._get_color(3)) + else: + self.curse_window.addch(row, col, cur_char) self.curse_window.clrtoeol() self.curse_window.move(row+1, 0)