@@ -336,7 +336,8 @@ def process_event(self, e):
336336 self .update_completion ()
337337 return
338338
339- elif e in ("KEY_RIGHT" ) and self .cursor_offset == len (self .current_line ):
339+ elif (e in ("KEY_RIGHT" , '\x06 ' ) and self .config .curtsies_right_arrow_completion
340+ and self .cursor_offset == len (self .current_line )):
340341 self .current_line += self .current_suggestion
341342 self .cursor_offset = len (self .current_line )
342343 self .update_completion ()
@@ -348,13 +349,15 @@ def process_event(self, e):
348349 # readline history commands
349350 elif e in ("KEY_UP" ,) + key_dispatch [self .config .up_one_line_key ]:
350351 self .rl_history .enter (self .current_line )
351- self .current_line = self .rl_history .back (False , search = True )
352+ self .current_line = self .rl_history .back (False ,
353+ search = self .config .curtsies_right_arrow_completion )
352354 self .cursor_offset = len (self .current_line )
353355 self .update_completion ()
354356
355357 elif e in ("KEY_DOWN" ,) + key_dispatch [self .config .down_one_line_key ]:
356358 self .rl_history .enter (self .current_line )
357- self .current_line = self .rl_history .forward (False , search = True )
359+ self .current_line = self .rl_history .forward (False ,
360+ search = self .config .curtsies_right_arrow_completion )
358361 self .cursor_offset = len (self .current_line )
359362 self .update_completion ()
360363 elif e in key_dispatch [self .config .search_key ]: #TODO Not Implemented
@@ -664,6 +667,9 @@ def current_line_formatted(self):
664667 """The colored current line (no prompt, not wrapped)"""
665668 if self .config .syntax :
666669 fs = bpythonparse (format (self .tokenize (self .current_line ), self .formatter ))
670+ if self .rl_history .saved_line in self .current_line :
671+ if self .config .curtsies_right_arrow_completion :
672+ fs = fmtfuncs .on_magenta (self .rl_history .saved_line ).join (fs .split (self .rl_history .saved_line ))
667673 logging .debug ('Display line %r -> %r' , self .current_line , fs )
668674 else :
669675 fs = fmtstr (self .current_line )
@@ -707,7 +713,10 @@ def current_cursor_line_without_suggestion(self):
707713
708714 @property
709715 def current_cursor_line (self ):
710- return self .current_cursor_line_without_suggestion + fmtfuncs .bold (fmtfuncs .dark ((self .current_suggestion )))
716+ if self .config .curtsies_right_arrow_completion :
717+ return self .current_cursor_line_without_suggestion + fmtfuncs .bold (fmtfuncs .dark ((self .current_suggestion )))
718+ else :
719+ return self .current_cursor_line_without_suggestion
711720
712721 @property
713722 def current_suggestion (self ):
0 commit comments