I have the following code that draws a small window with a message using curses
.
import curses
import time
screen = curses.initscr()
curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
window = curses.newwin(15, 60)
window.bkgd(' ', curses.color_pair(1))
window.addstr(7, 1, 'Hello')
window.refresh()
time.sleep(2)
curses.endwin()
I expect the background color to be blue, but the behavior is not consistent in iTerm2. With TERM=screen
, I get the expected output:
When TERM=xterm
though, spaces are not painted:
If I use a different character for the background, it's painted correctly. What could be the issue?
I'm using Python 3 and iTerm2 3.0.
The problem is that tmux does not support the "back color erase" feature assumed in the xterm terminal description.
Further reading: