@@ -676,7 +676,7 @@ def process_key_event(self, e):
676
676
elif e in ("<Ctrl-d>" ,):
677
677
self .on_control_d ()
678
678
elif e in ("<Ctrl-o>" ,):
679
- self .on_control_o ()
679
+ self .operate_and_get_next ()
680
680
elif e in ("<Esc+.>" ,):
681
681
self .get_last_word ()
682
682
elif e in key_dispatch [self .config .reverse_incremental_search_key ]:
@@ -846,20 +846,25 @@ def on_control_d(self):
846
846
self .current_line = (self .current_line [:self .cursor_offset ] +
847
847
self .current_line [(self .cursor_offset + 1 ):])
848
848
849
- def on_control_o (self ):
850
- next_idx = - self .rl_history .index + 1
851
- next = self .rl_history .entries [next_idx ]
852
- self .on_enter ()
853
- print ("Next is : " + next )
854
- self ._set_current_line (next )
855
-
856
849
def cut_to_buffer (self ):
857
850
self .cut_buffer = self .current_line [self .cursor_offset :]
858
851
self .current_line = self .current_line [:self .cursor_offset ]
859
852
860
853
def yank_from_buffer (self ):
861
854
pass
862
855
856
+ def operate_and_get_next (self ):
857
+ # If we have not navigated back in history
858
+ # ctrl+o will have the same effect as enter
859
+ if self .rl_history .index == 0 or self .rl_history .index == 1 :
860
+ self .on_enter ()
861
+ return
862
+
863
+ index = self .rl_history .index
864
+ self .on_enter ()
865
+ self .rl_history .index = index
866
+ self ._set_current_line (self .rl_history .entries [- index ], reset_rl_history = False )
867
+
863
868
def up_one_line (self ):
864
869
self .rl_history .enter (self .current_line )
865
870
self ._set_current_line (tabs_to_spaces (self .rl_history .back (
0 commit comments