960 y, xstart = window.getyx() |
960 y, xstart = window.getyx() |
961 width = self.xscreensize |
961 width = self.xscreensize |
962 # turn tabs into spaces |
962 # turn tabs into spaces |
963 instr = instr.expandtabs(4) |
963 instr = instr.expandtabs(4) |
964 strwidth = encoding.colwidth(instr) |
964 strwidth = encoding.colwidth(instr) |
965 numspaces = (width - ((strwidth + xstart) % width) - 1) |
965 numspaces = (width - ((strwidth + xstart) % width)) |
966 return instr + " " * numspaces + "\n" |
966 return instr + " " * numspaces |
967 |
967 |
968 def printstring(self, window, text, fgcolor=None, bgcolor=None, pair=None, |
968 def printstring(self, window, text, fgcolor=None, bgcolor=None, pair=None, |
969 pairname=None, attrlist=None, towin=True, align=True, showwhtspc=False): |
969 pairname=None, attrlist=None, towin=True, align=True, showwhtspc=False): |
970 """ |
970 """ |
971 print the string, text, with the specified colors and attributes, to |
971 print the string, text, with the specified colors and attributes, to |
1768 # screen" from another program (or previous iterations of ourself), and |
1768 # screen" from another program (or previous iterations of ourself), and |
1769 # we won't clear it if the scroll region is small enough to comfortably |
1769 # we won't clear it if the scroll region is small enough to comfortably |
1770 # fit on the terminal. |
1770 # fit on the terminal. |
1771 self.stdscr.clear() |
1771 self.stdscr.clear() |
1772 |
1772 |
|
1773 # don't display the cursor |
|
1774 try: |
|
1775 curses.curs_set(0) |
|
1776 except curses.error: |
|
1777 pass |
|
1778 |
1773 # available colors: black, blue, cyan, green, magenta, white, yellow |
1779 # available colors: black, blue, cyan, green, magenta, white, yellow |
1774 # init_pair(color_id, foreground_color, background_color) |
1780 # init_pair(color_id, foreground_color, background_color) |
1775 self.initcolorpair(None, None, name="normal") |
1781 self.initcolorpair(None, None, name="normal") |
1776 self.initcolorpair(curses.COLOR_WHITE, curses.COLOR_MAGENTA, |
1782 self.initcolorpair(curses.COLOR_WHITE, curses.COLOR_MAGENTA, |
1777 name="selected") |
1783 name="selected") |