@@ -50,9 +50,9 @@ def _make_unctrl_map():
50
50
# rewritten in C; it's not required though.
51
51
try :
52
52
raise ImportError # currently it's borked by the unicode support
53
-
53
+
54
54
from _pyrepl_utils import disp_str , init_unctrl_map
55
-
55
+
56
56
init_unctrl_map (_make_unctrl_map ())
57
57
58
58
del init_unctrl_map
@@ -127,7 +127,7 @@ def make_default_syntax_table():
127
127
(r'\C-x\C-u' , 'upcase-region' ),
128
128
(r'\C-y' , 'yank' ),
129
129
(r'\C-z' , 'suspend' ),
130
-
130
+
131
131
(r'\M-b' , 'backward-word' ),
132
132
(r'\M-c' , 'capitalize-word' ),
133
133
(r'\M-d' , 'kill-word' ),
@@ -161,8 +161,8 @@ def make_default_syntax_table():
161
161
(r'\<delete>' , 'delete' ),
162
162
(r'\<backspace>' , 'backspace' ),
163
163
(r'\M-\<backspace>' , 'backward-kill-word' ),
164
- (r'\<end>' , 'end' ),
165
- (r'\<home>' , 'home ' ),
164
+ (r'\<end>' , 'end-of-line ' ), # was 'end'
165
+ (r'\<home>' , 'beginning-of-line ' ), # was 'home'
166
166
(r'\<f1>' , 'help' ),
167
167
(r'\EOF' , 'end' ), # the entries in the terminfo database for xterms
168
168
(r'\EOH' , 'home' ), # seem to be wrong. this is a less than ideal
@@ -313,7 +313,7 @@ def calc_screen(self):
313
313
314
314
def process_prompt (self , prompt ):
315
315
""" Process the prompt.
316
-
316
+
317
317
This means calculate the length of the prompt. The character \x01
318
318
and \x02 are used to bracket ANSI control sequences and need to be
319
319
excluded from the length calculation. So also a copy of the prompt
@@ -382,7 +382,7 @@ def bol(self, p=None):
382
382
while p >= 0 and b [p ] != '\n ' :
383
383
p -= 1
384
384
return p + 1
385
-
385
+
386
386
def eol (self , p = None ):
387
387
"""Return the 0-based index of the line break following p most
388
388
immediately.
@@ -473,7 +473,7 @@ def after_command(self, cmd):
473
473
"""This function is called to allow post command cleanup."""
474
474
if getattr (cmd , "kills_digit_arg" , 1 ):
475
475
if self .arg is not None :
476
- self .dirty = 1
476
+ self .dirty = 1
477
477
self .arg = None
478
478
479
479
def prepare (self ):
@@ -592,13 +592,15 @@ def handle1(self, block=1):
592
592
def push_char (self , char ):
593
593
self .console .push_char (char )
594
594
self .handle1 (0 )
595
-
596
- def readline (self , returns_unicode = False ):
595
+
596
+ def readline (self , returns_unicode = False , startup_hook = None ):
597
597
"""Read a line. The implementation of this method also shows
598
598
how to drive Reader if you want more control over the event
599
599
loop."""
600
600
self .prepare ()
601
601
try :
602
+ if startup_hook is not None :
603
+ startup_hook ()
602
604
self .refresh ()
603
605
while not self .finished :
604
606
self .handle1 ()
0 commit comments