Show More
@@ -106,18 +106,6 b' def _detect_screen_size(screen_lines_def):' | |||
|
106 | 106 | # can fail on Linux 2.6, pager_page will catch the TypeError |
|
107 | 107 | raise TypeError('termios error: {0}'.format(err)) |
|
108 | 108 | |
|
109 | # Curses modifies the stdout buffer size by default, which messes | |
|
110 | # up Python's normal stdout buffering. This would manifest itself | |
|
111 | # to IPython users as delayed printing on stdout after having used | |
|
112 | # the pager. | |
|
113 | # | |
|
114 | # We can prevent this by manually setting the NCURSES_NO_SETBUF | |
|
115 | # environment variable. For more details, see: | |
|
116 | # http://bugs.python.org/issue10144 | |
|
117 | NCURSES_NO_SETBUF = os.environ.get('NCURSES_NO_SETBUF', None) | |
|
118 | os.environ['NCURSES_NO_SETBUF'] = '' | |
|
119 | ||
|
120 | # Proceed with curses initialization | |
|
121 | 109 | try: |
|
122 | 110 | scr = curses.initscr() |
|
123 | 111 | except AttributeError: |
@@ -127,12 +115,6 b' def _detect_screen_size(screen_lines_def):' | |||
|
127 | 115 | screen_lines_real,screen_cols = scr.getmaxyx() |
|
128 | 116 | curses.endwin() |
|
129 | 117 | |
|
130 | # Restore environment | |
|
131 | if NCURSES_NO_SETBUF is None: | |
|
132 | del os.environ['NCURSES_NO_SETBUF'] | |
|
133 | else: | |
|
134 | os.environ['NCURSES_NO_SETBUF'] = NCURSES_NO_SETBUF | |
|
135 | ||
|
136 | 118 | # Restore terminal state in case endwin() didn't. |
|
137 | 119 | termios.tcsetattr(sys.stdout,termios.TCSANOW,term_flags) |
|
138 | 120 | # Now we have what we needed: the screen size in rows/columns |
General Comments 0
You need to be logged in to leave comments.
Login now