X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdrv%2Fvterm.c;h=4095feb76ad49823a61b115b5e41942508fa8d64;hb=5c46f86c5a8ceaa63a1a9919cf1f4d2889c6c233;hp=d33fad9871c3c0a312b51463922550eaf4873383;hpb=f035491c949cb86d92a93fc3d9d033538704256b;p=tpg%2Facess2.git diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index d33fad98..4095feb7 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -425,7 +425,7 @@ void VT_SetTerminal(int ID) modeNum = mode.id; gVT_Terminals[ ID ].RealWidth = mode.width; gVT_Terminals[ ID ].RealHeight = mode.height; - VFS_IOCtl( giVT_OutputDevHandle, VIDEO_IOCTL_SETMODE, &modeNum ); + VFS_IOCtl( giVT_OutputDevHandle, VIDEO_IOCTL_GETSETMODE, &modeNum ); // Update current terminal ID Log("Changed terminal from %i to %i", giVT_CurrentTerminal, ID); @@ -503,7 +503,7 @@ void VT_KBCallBack(Uint32 Codepoint) if(term->Mode == TERM_MODE_TEXT) { Uint8 buf[6] = {0}; - int len; + int len = 0; // Ignore Modifer Keys if(Codepoint > KEY_MODIFIERS) return; @@ -512,20 +512,43 @@ void VT_KBCallBack(Uint32 Codepoint) switch(Codepoint) { case KEY_LEFT: - buf[0] = '\x1B'; buf[1] = '['; - buf[2] = 'D'; len = 3; + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'D'; + len = 3; break; case KEY_RIGHT: - buf[0] = '\x1B'; buf[1] = '['; - buf[2] = 'C'; len = 3; + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'C'; + len = 3; break; + case KEY_UP: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'A'; + len = 3; + break; + case KEY_DOWN: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'B'; + len = 3; + break; + + case KEY_PGUP: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = '5'; // Some overline also + //len = 4; // Commented out until I'm sure + break; + case KEY_PGDOWN: + len = 0; + break; + + // Attempt to encode in UTF-8 default: len = WriteUTF8( buf, Codepoint ); - //Log("Codepoint = 0x%x", Codepoint); + if(len == 0) { + Warning("Codepoint (%x) is unrepresentable in UTF-8", Codepoint); + } break; } - //Log("len = %i, buf = %s", len, buf); + if(len == 0) { + // Unprintable / Don't Pass + return; + } // Write if( MAX_INPUT_CHARS8 - term->InputWrite >= len )