X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fdrv%2Fvterm_input.c;h=6c25cc81974a888863f4b653a9630f6d8abd8500;hb=9659f4f4435c25edeafacece13450da80c9d5066;hp=b44564ec9702a3187232dc4cbeb0e823e7ce6376;hpb=f194730e75d6d3681e5f99a4efed1616fd1ea738;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/drv/vterm_input.c b/KernelLand/Kernel/drv/vterm_input.c index b44564ec..6c25cc81 100644 --- a/KernelLand/Kernel/drv/vterm_input.c +++ b/KernelLand/Kernel/drv/vterm_input.c @@ -101,16 +101,14 @@ void VT_KBCallBack(Uint32 Codepoint) case KEYSYM_PGUP: if( term->Flags & VT_FLAG_ALTBUF ) return ; - term->ViewPos = MAX( 0, term->ViewPos - term->Width ); + term->ViewTopRow = MAX(0, term->ViewTopRow - 1); VT_int_UpdateScreen(term, 1); return; case KEYSYM_PGDN: if( term->Flags & VT_FLAG_ALTBUF ) return ; - term->ViewPos = MIN( - term->ViewPos + term->Width, - term->Width * term->Height * giVT_Scrollback - ); + // 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); VT_int_UpdateScreen(term, 1); return; } @@ -118,7 +116,7 @@ void VT_KBCallBack(Uint32 Codepoint) } // Encode key - if(term->Mode == TERM_MODE_TEXT) + if(term->Mode == PTYBUFFMT_TEXT) { Uint8 buf[6] = {0}; int len = 0; @@ -231,70 +229,11 @@ void VT_KBCallBack(Uint32 Codepoint) return; } - // TODO: Implement Ctrl-C etc -#if 0 - // Handle meta characters - if( !(term->Flags & VT_FLAG_RAWIN) ) - { - // Implementation options for Ctrl-C -> SIGINT - // - Kernel-land: here in the VT - // > Pros: No userland change needed - // > Cons: Requires process groups - // - User-land, in the shell - // > Pros: Less threading changes - // > Cons: Needs the shell to get all user input before the app, worse latency - // > Won't work with bash etc - switch(buf[0]) - { - case '\3': // ^C - - break; - } - } -#endif - - // Write - if( MAX_INPUT_CHARS8 - term->InputWrite >= len ) { - memcpy( &term->InputBuffer[term->InputWrite], buf, len ); - } - else { - memcpy( &term->InputBuffer[term->InputWrite], buf, MAX_INPUT_CHARS8 - term->InputWrite ); - memcpy( &term->InputBuffer[0], buf, len - (MAX_INPUT_CHARS8 - term->InputWrite) ); - } - // Roll the buffer over - term->InputWrite += len; - term->InputWrite %= MAX_INPUT_CHARS8; - if( (term->InputWrite - term->InputRead + MAX_INPUT_CHARS8)%MAX_INPUT_CHARS8 < len ) { - term->InputRead = term->InputWrite + 1; - term->InputRead %= MAX_INPUT_CHARS8; - } + PTY_SendInput(term->PTY, (void*)buf, len); } else { - // Encode the raw key event - Uint32 *raw_in = (void*)term->InputBuffer; - - #if 0 - // Drop new keys - if( term->InputWrite == term->InputRead ) - return ; - #endif - - raw_in[ term->InputWrite ] = Codepoint; - term->InputWrite ++; - if(term->InputWrite >= MAX_INPUT_CHARS32) - term->InputWrite -= MAX_INPUT_CHARS32; - - #if 1 - // TODO: Should old or new be dropped? - if(term->InputRead == term->InputWrite) { - term->InputRead ++; - if( term->InputRead >= MAX_INPUT_CHARS32 ) - term->InputRead -= MAX_INPUT_CHARS32; - } - #endif + PTY_SendInput(term->PTY, (void*)&Codepoint, sizeof(Codepoint)); } - - VFS_MarkAvaliable(&term->Node, 1); }