From: Christian Heller Date: Wed, 26 Aug 2020 23:34:43 +0000 (+0200) Subject: Merge branch 'master' into 7drl2016 X-Git-Tag: TCE_proper_minor_fixes X-Git-Url: https://plomlompom.com/repos/foo.html?a=commitdiff_plain;h=d6659c644efbfaa3906c7ab36b17ca68c0dd1961;hp=-c;p=plomrogue Merge branch 'master' into 7drl2016 --- d6659c644efbfaa3906c7ab36b17ca68c0dd1961 diff --combined client/window_management.py index 4d6a403,a896b02..9d78737 --- a/client/window_management.py +++ b/client/window_management.py @@@ -18,11 -18,10 +18,11 @@@ screen_size = [0,0 class Window: - def __init__(self, title, draw_function, size): + def __init__(self, title, draw_function, size, draw_scroll_hints): self.title = title self.draw = types.MethodType(draw_function, self) self.size = size + self.draw_scroll_hints = draw_scroll_hints def set_windows(): @@@ -100,8 -99,7 +100,8 @@@ windows = [] for config in windows_config: size = size_window(config["config"]) - window = Window(config["title"], config["func"], size) + window = Window(config["title"], config["func"], size, + config["scroll_hints"]) windows.append(window) place_window(window) redraw_windows = True @@@ -110,14 -108,20 +110,20 @@@ def draw_screen(): def healthy_addch(y, x, char, attr=0): - """Workaround for .""" + """Wrap Python curses' addch() weirdnesses into sane interface. + + Works around with + 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) - stdscr.addch(y, x - 1, char, attr) + stdscr.addch(y, x - 1, char.encode(), attr) 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: - stdscr.addch(y, x, char, attr) + stdscr.addch(y, x, char.encode(), attr) def draw_window_border_lines(): for win in windows: @@@ -213,8 -217,7 +219,8 @@@ for win in windows: offset, winmap_size, winmap = win.draw() draw_winmap() - draw_scroll_hints() + if win.draw_scroll_hints: + draw_scroll_hints() stdscr.erase() draw_window_border_lines()