@@ -292,16 +292,6 @@ def atbol(self):
292292
293293 return not self .s .lstrip ()
294294
295- def back (self ):
296- """Replace the active line with previous line in history and
297- increment the index to keep track"""
298-
299- self .cpos = 0
300- self .rl_history .enter (self .s )
301- self .clear_wrapped_lines ()
302- self .s = self .rl_history .back ()
303- self .print_line (self .s , clr = True )
304-
305295 def bs (self , delete_tabs = True ):
306296 """Process a backspace"""
307297
@@ -498,6 +488,33 @@ def end(self, refresh=True):
498488
499489 return True
500490
491+ def hbegin (self ):
492+ """Replace the active line with first line in history and
493+ increment the index to keep track"""
494+ self .cpos = 0
495+ self .clear_wrapped_lines ()
496+ self .rl_history .enter (self .s )
497+ self .s = self .rl_history .first ()
498+ self .print_line (self .s , clr = True )
499+
500+ def hend (self ):
501+ """Same as hbegin() but, well, forward"""
502+ self .cpos = 0
503+ self .clear_wrapped_lines ()
504+ self .rl_history .enter (self .s )
505+ self .s = self .rl_history .last ()
506+ self .print_line (self .s , clr = True )
507+
508+ def back (self ):
509+ """Replace the active line with previous line in history and
510+ increment the index to keep track"""
511+
512+ self .cpos = 0
513+ self .clear_wrapped_lines ()
514+ self .rl_history .enter (self .s )
515+ self .s = self .rl_history .back ()
516+ self .print_line (self .s , clr = True )
517+
501518 def fwd (self ):
502519 """Same as back() but, well, forward"""
503520
@@ -787,6 +804,14 @@ def p_key(self, key):
787804 # Redraw (as there might have been highlighted parens)
788805 self .print_line (self .s )
789806
807+ elif key in ("KEY_NPAGE" , '\T' ): # page_down or \T
808+ self .hend ()
809+ self .print_line (self .s )
810+
811+ elif key in ("KEY_PPAGE" , '\S' ): # page_up or \S
812+ self .hbegin ()
813+ self .print_line (self .s )
814+
790815 elif key in key_dispatch [config .cut_to_buffer_key ]: # cut to buffer
791816 self .cut_to_buffer ()
792817 return ''
0 commit comments