6868if not py3 :
6969 import inspect
7070
71+
72+ # --- module globals ---
7173stdscr = None
74+ colors = None
75+
76+ DO_RESIZE = False
77+ # ---
7278
7379def getpreferredencoding ():
7480 return locale .getpreferredencoding () or sys .getdefaultencoding ()
@@ -180,8 +186,6 @@ def read(self, size=None):
180186 def readlines (self , size = - 1 ):
181187 return list (iter (self .readline , '' ))
182188
183- DO_RESIZE = False
184-
185189# TODO:
186190#
187191# Tab completion does not work if not at the end of the line.
@@ -197,6 +201,7 @@ def readlines(self, size=-1):
197201
198202
199203def get_color (config , name ):
204+ global colors
200205 return colors [config .color_scheme [name ].lower ()]
201206
202207
@@ -1279,6 +1284,7 @@ def lsize():
12791284 def size (self ):
12801285 """Set instance attributes for x and y top left corner coordinates
12811286 and width and heigth for the window."""
1287+ global stdscr
12821288 h , w = stdscr .getmaxyx ()
12831289 self .y = 0
12841290 self .w = w
@@ -1522,6 +1528,7 @@ def init_wins(scr, colors, config):
15221528 """Initialise the two windows (the main repl interface and the little
15231529 status bar at the bottom with some stuff in it)"""
15241530#TODO: Document better what stuff is on the status bar.
1531+ #TODO: colors argument is not used
15251532
15261533 background = get_colpair (config , 'background' )
15271534 h , w = gethw ()
@@ -1578,6 +1585,7 @@ def idle(caller):
15781585 The statusbar check needs to go here to take care of timed
15791586 messages and the resize handlers need to be here to make
15801587 sure it happens conveniently."""
1588+ global DO_RESIZE
15811589
15821590 if importcompletion .find_coroutine () or caller .paste_mode :
15831591 caller .scr .nodelay (True )
@@ -1667,7 +1675,6 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
16671675 global stdscr
16681676 global DO_RESIZE
16691677 global colors
1670- global repl
16711678 DO_RESIZE = False
16721679
16731680 old_sigwinch_handler = signal .signal (signal .SIGWINCH ,
@@ -1734,8 +1741,6 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
17341741
17351742
17361743def main (args = None , locals_ = None , banner = None ):
1737- global stdscr
1738-
17391744 locale .setlocale (locale .LC_ALL , "" )
17401745 translations .init ()
17411746
0 commit comments