Usermode/ld-acess - Clean up loadlib.c, improved debug
[tpg/acess2.git] / KernelLand / Kernel / drv / vterm_input.c
index 6c25cc8..15da798 100644 (file)
@@ -75,6 +75,9 @@ void VT_KBCallBack(Uint32 Codepoint)
                
                switch(term->RawScancode)
                {
+               case KEYSYM_DELETE:
+                       // TODO: Reboot, or poke secure registered app
+                       return;
                case KEYSYM_F1 :        VT_SetTerminal(0);      return;
                case KEYSYM_F2 :        VT_SetTerminal(1);      return;
                case KEYSYM_F3 :        VT_SetTerminal(2);      return;
@@ -95,20 +98,26 @@ void VT_KBCallBack(Uint32 Codepoint)
                
 //             Log_Debug("VTerm", "Magic Ctrl-Alt-0x%x", term->RawScancode);   
 
+               const unsigned int scroll_step = term->TextHeight / 2;
+               // Note the lack of giVT_Scrollback+1, view top can't go above size-onescreen
+               const unsigned int scroll_max = term->TextHeight * giVT_Scrollback;
                switch(term->RawScancode)
                {
-               // Scrolling
+               // VTerm scrolling
+               // - Scrolls half a screen at a time
+               // - View up (text goes down)
                case KEYSYM_PGUP:
                        if( term->Flags & VT_FLAG_ALTBUF )
                                return ;
-                       term->ViewTopRow = MAX(0, term->ViewTopRow - 1);
+                       term->ViewTopRow = (term->ViewTopRow > scroll_step ? term->ViewTopRow - scroll_step : 0);
                        VT_int_UpdateScreen(term, 1);
                        return;
+               // - View down (text goes up)
                case KEYSYM_PGDN:
                        if( term->Flags & VT_FLAG_ALTBUF )
                                return ;
-                       // Note the lack of giVT_Scrollback+1, view top can't go above size-onescreen
-                       term->ViewTopRow = MIN(term->ViewTopRow + 1, term->Height * giVT_Scrollback);
+                       
+                       term->ViewTopRow = MIN(term->ViewTopRow + scroll_step, scroll_max);
                        VT_int_UpdateScreen(term, 1);
                        return;
                }

UCC git Repository :: git.ucc.asn.au