aboutsummaryrefslogtreecommitdiffstats
path: root/src/epy_reader/board.py
diff options
context:
space:
mode:
authorBenawi Adha <43810055+wustho@users.noreply.github.com>2023-02-08 22:23:58 +0700
committerGitHub <noreply@github.com>2023-02-08 22:23:58 +0700
commit7a53c047e2b1b3fdf6d73ea52a5402f929cabd77 (patch)
treed6081519766df71c17e26022de42024fd7c1a112 /src/epy_reader/board.py
parentcebdc6aff0657b6d830a49fd771eaf52812932d3 (diff)
downloadepy-7a53c047e2b1b3fdf6d73ea52a5402f929cabd77.tar.gz
Bugfix #61 (#84)
* Initial fix * Removed older codes * Bump version * Update funding
Diffstat (limited to 'src/epy_reader/board.py')
-rw-r--r--src/epy_reader/board.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/epy_reader/board.py b/src/epy_reader/board.py
index 0562d3f..9c5423e 100644
--- a/src/epy_reader/board.py
+++ b/src/epy_reader/board.py
@@ -79,7 +79,19 @@ class InfiniBoard:
def write(self, row: int, bottom_padding: int = 0) -> None:
for n_row in range(min(self.screen_rows - bottom_padding, self.total_lines - row)):
text_line = self.text[row + n_row]
- self.screen.addstr(n_row, self.x, text_line)
+
+ # NOTE: A bug with python itself: https://bugs.python.org/issue8243
+ # It's stated in python docs:
+ # > Attempting to write to the lower right corner of a window, subwindow,
+ # > or pad will cause an exception to be raised after the character is printed.
+ # https://github.com/python/cpython/commit/ef5ce884a41c8553a7eff66ebace908c1dcc1f89#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049fR691-R692
+ #
+ # Since the exception is raised "after the character is printed"
+ # then it seems to be safe to catch it.
+ try:
+ self.screen.addstr(n_row, self.x, text_line)
+ except curses.error:
+ pass
if (
self.spread == 2