Skip to content

Commit 0ac6514

Browse files
bagagepellouxprayer
authored andcommitted
Do not init_pair(0) which causes ERR on windows
1 parent 3816e5c commit 0ac6514

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

suplemon/ui.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os
77
import sys
8+
import platform
89
import logging
910
from wcwidth import wcswidth
1011

@@ -199,7 +200,10 @@ def setup_colors(self):
199200
# curses.init_pair(10, -1, -1) # Default (white on black)
200201
# Colors for xterm (not xterm-256color)
201202
# Dark Colors
202-
curses.init_pair(0, curses.COLOR_BLACK, bg) # 0 Black
203+
204+
if platform.system() != 'Windows':
205+
# it raises an exception on windows, cf https://github.com/zephyrproject-rtos/windows-curses/issues/10
206+
curses.init_pair(0, curses.COLOR_BLACK, bg) # 0 Black
203207
curses.init_pair(1, curses.COLOR_RED, bg) # 1 Red
204208
curses.init_pair(2, curses.COLOR_GREEN, bg) # 2 Green
205209
curses.init_pair(3, curses.COLOR_YELLOW, bg) # 3 Yellow
@@ -230,7 +234,9 @@ def setup_colors(self):
230234
# TODO: Define RGB for these to avoid getting
231235
# different results in different terminals
232236
# xterm-256color chart http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
233-
curses.init_pair(0, 242, bg) # 0 Black
237+
if platform.system() != 'Windows':
238+
# it raises an exception on windows, cf https://github.com/zephyrproject-rtos/windows-curses/issues/10
239+
curses.init_pair(0, 242, bg) # 0 Black
234240
curses.init_pair(1, 204, bg) # 1 Red
235241
curses.init_pair(2, 119, bg) # 2 Green
236242
curses.init_pair(3, 221, bg) # 3 Yellow

0 commit comments

Comments
 (0)