Skip to content

Commit

Permalink
remove unneccacary try-catcj
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Feb 13, 2024
1 parent 39a1e45 commit cf17104
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions cat_win/util/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cf17104

Please sign in to comment.