home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a4e6c51
)
Fix buggy healthy_addch().
master
PtIG
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 20 Aug 2017 22:10:41 +0000
(
00:10
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 20 Aug 2017 22:10:41 +0000
(
00:10
+0200)
client/window_management.py
patch
|
blob
|
history
diff --git
a/client/window_management.py
b/client/window_management.py
index 610764b5402bf69fd83b57c5ad94243acf64b616..a896b0207e39bb970db07572145dbf07ae69f6b0 100644
(file)
--- a/
client/window_management.py
+++ b/
client/window_management.py
@@
-108,14
+108,20
@@
def set_windows():
def draw_screen():
def healthy_addch(y, x, char, attr=0):
def draw_screen():
def healthy_addch(y, x, char, attr=0):
- """Workaround for <http://stackoverflow.com/questions/7063128/>."""
+ """Wrap Python curses' addch() weirdnesses into sane interface.
+
+ Works around <http://stackoverflow.com/questions/7063128/> with
+ <https://stackoverflow.com/a/26797300> and enforces char to be a byte
+ instead of a single-char string.
+ """
if y == screen_size[0] - 1 and x == screen_size[1] - 1:
char_before = stdscr.inch(y, x - 1)
if y == screen_size[0] - 1 and x == screen_size[1] - 1:
char_before = stdscr.inch(y, x - 1)
- stdscr.addch(y, x - 1, char, attr)
+ stdscr.addch(y, x - 1, char
.encode()
, attr)
stdscr.insstr(y, x - 1, " ")
stdscr.insstr(y, x - 1, " ")
- stdscr.addch(y, x - 1, char_before)
+ stdscr.addch(y, x - 1,
+ char_before & 0xFF, char_before & curses.A_ATTRIBUTES)
else:
else:
- stdscr.addch(y, x, char, attr)
+ stdscr.addch(y, x, char
.encode()
, attr)
def draw_window_border_lines():
for win in windows:
def draw_window_border_lines():
for win in windows: