68
68
if not py3 :
69
69
import inspect
70
70
71
+
72
+ # --- module globals ---
71
73
stdscr = None
74
+ colors = None
75
+
76
+ DO_RESIZE = False
77
+ # ---
72
78
73
79
def getpreferredencoding ():
74
80
return locale .getpreferredencoding () or sys .getdefaultencoding ()
@@ -180,8 +186,6 @@ def read(self, size=None):
180
186
def readlines (self , size = - 1 ):
181
187
return list (iter (self .readline , '' ))
182
188
183
- DO_RESIZE = False
184
-
185
189
# TODO:
186
190
#
187
191
# Tab completion does not work if not at the end of the line.
@@ -197,6 +201,7 @@ def readlines(self, size=-1):
197
201
198
202
199
203
def get_color (config , name ):
204
+ global colors
200
205
return colors [config .color_scheme [name ].lower ()]
201
206
202
207
@@ -1279,6 +1284,7 @@ def lsize():
1279
1284
def size (self ):
1280
1285
"""Set instance attributes for x and y top left corner coordinates
1281
1286
and width and heigth for the window."""
1287
+ global stdscr
1282
1288
h , w = stdscr .getmaxyx ()
1283
1289
self .y = 0
1284
1290
self .w = w
@@ -1522,6 +1528,7 @@ def init_wins(scr, colors, config):
1522
1528
"""Initialise the two windows (the main repl interface and the little
1523
1529
status bar at the bottom with some stuff in it)"""
1524
1530
#TODO: Document better what stuff is on the status bar.
1531
+ #TODO: colors argument is not used
1525
1532
1526
1533
background = get_colpair (config , 'background' )
1527
1534
h , w = gethw ()
@@ -1578,6 +1585,7 @@ def idle(caller):
1578
1585
The statusbar check needs to go here to take care of timed
1579
1586
messages and the resize handlers need to be here to make
1580
1587
sure it happens conveniently."""
1588
+ global DO_RESIZE
1581
1589
1582
1590
if importcompletion .find_coroutine () or caller .paste_mode :
1583
1591
caller .scr .nodelay (True )
@@ -1667,7 +1675,6 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
1667
1675
global stdscr
1668
1676
global DO_RESIZE
1669
1677
global colors
1670
- global repl
1671
1678
DO_RESIZE = False
1672
1679
1673
1680
old_sigwinch_handler = signal .signal (signal .SIGWINCH ,
@@ -1734,8 +1741,6 @@ def main_curses(scr, args, config, interactive=True, locals_=None,
1734
1741
1735
1742
1736
1743
def main (args = None , locals_ = None , banner = None ):
1737
- global stdscr
1738
-
1739
1744
locale .setlocale (locale .LC_ALL , "" )
1740
1745
translations .init ()
1741
1746
0 commit comments