From: John Hodge Date: Wed, 8 Jun 2011 04:00:25 +0000 (+0800) Subject: VTerm - Bugfixing mostly X-Git-Tag: rel0.10~72 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=768eb85491125c0073e7739641c2b317dc8d1605;p=tpg%2Facess2.git VTerm - Bugfixing mostly - Fixed compile errors in AxWin2 - Implementing a fixed input bar in IRC client - Fixed scrolling issues in VTerm --- diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index bb658f2f..bead23cf 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -984,6 +984,9 @@ int VT_int_ParseEscape(tVTerm *Term, char *Buffer) break; } break; + default: + Log_Warning("VTerm", "Unknown control sequence '\\x1B[?%c'", c); + break; } } else @@ -1050,16 +1053,26 @@ int VT_int_ParseEscape(tVTerm *Term, char *Buffer) Term->AltWritePos = args[0] + args[1]*Term->TextWidth; else Term->WritePos = args[0] + args[1]*Term->TextWidth; - Log_Debug("VTerm", "args = {%i, %i}", args[0], args[1]); + //Log_Debug("VTerm", "args = {%i, %i}", args[0], args[1]); break; // Scroll up `n` lines case 'S': tmp = -1; // Scroll down `n` lines - case 'P': + case 'T': if(argc == 1) tmp *= args[0]; - + if( Term->Flags & VT_FLAG_ALTBUF ) + VT_int_ScrollText(Term, tmp); + else + { + if(Term->ViewPos/Term->TextWidth + tmp < 0) + break; + if(Term->ViewPos/Term->TextWidth + tmp > Term->TextHeight * (giVT_Scrollback + 1)) + break; + + Term->ViewPos += Term->TextWidth*tmp; + } break; // Set Font flags @@ -1097,7 +1110,7 @@ int VT_int_ParseEscape(tVTerm *Term, char *Buffer) break; default: - Log_Warning("VTerm", "Unknown control sequence"); + Log_Warning("VTerm", "Unknown control sequence '\\x1B[%c'", c); break; } } @@ -1264,8 +1277,11 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch) // Update the last line Term->WritePos -= Term->TextWidth; VT_int_UpdateScreen( Term, 0 ); + Term->WritePos += Term->TextWidth; VT_int_ScrollText(Term, 1); + + Term->ViewPos += Term->TextWidth; } } @@ -1276,7 +1292,7 @@ void VT_int_ScrollText(tVTerm *Term, int Count) { tVT_Char *buf; int height, init_write_pos; - int base, len, i; + int len, i; if( Term->Flags & VT_FLAG_ALTBUF ) { @@ -1293,9 +1309,10 @@ void VT_int_ScrollText(tVTerm *Term, int Count) if( Count > 0 ) { + int base; if(Count > Term->ScrollHeight) Count = Term->ScrollHeight; base = Term->TextWidth*(Term->ScrollTop + Term->ScrollHeight - Count); - len = Term->TextWidth*(height - Term->ScrollHeight - Count - Term->ScrollTop); + len = Term->TextWidth*(Term->ScrollHeight - Count); // Scroll terminal cache memcpy( @@ -1312,7 +1329,11 @@ void VT_int_ScrollText(tVTerm *Term, int Count) // Update Screen VT_int_ScrollFramebuffer( Term, Count ); - Term->WritePos = Term->ViewPos + Term->ScrollTop + (Term->ScrollHeight - Count); + if( Term->Flags & VT_FLAG_ALTBUF ) + Term->AltWritePos = Term->TextWidth*(Term->ScrollTop + Term->ScrollHeight - Count); + else + Term->WritePos = Term->ViewPos + Term->TextWidth*(Term->ScrollTop + Term->ScrollHeight - Count); +// Log_Debug("VTerm", "Term->WritePos = %i/%i = %i", Term->WritePos, Term->TextWidth, Term->WritePos/Term->TextWidth); for( i = 0; i < Count; i ++ ) { VT_int_UpdateScreen( Term, 0 ); @@ -1327,7 +1348,7 @@ void VT_int_ScrollText(tVTerm *Term, int Count) Count = -Count; if(Count > Term->ScrollHeight) Count = Term->ScrollHeight; - len = Term->TextWidth*(height - Term->ScrollHeight - Count - Term->ScrollTop); + len = Term->TextWidth*(Term->ScrollHeight - Count); // Scroll terminal cache memcpy( @@ -1343,7 +1364,10 @@ void VT_int_ScrollText(tVTerm *Term, int Count) } VT_int_ScrollFramebuffer( Term, -Count ); - Term->WritePos = Term->ViewPos + Term->ScrollTop; + if( Term->Flags & VT_FLAG_ALTBUF ) + Term->AltWritePos = Term->TextWidth*Term->ScrollTop; + else + Term->WritePos = Term->ViewPos + Term->TextWidth*Term->ScrollTop; for( i = 0; i < Count; i ++ ) { VT_int_UpdateScreen( Term, 0 ); @@ -1392,14 +1416,14 @@ void VT_int_ScrollFramebuffer( tVTerm *Term, int Count ) { buf.SrcY = (Term->ScrollTop+Count) * giVT_CharHeight; buf.DstY = Term->ScrollTop * giVT_CharHeight; - buf.H = (Term->ScrollHeight-Count) * giVT_CharHeight; } else // Scroll up, move text down { + Count = -Count; buf.SrcY = Term->ScrollTop * giVT_CharHeight; buf.DstY = (Term->ScrollTop+Count) * giVT_CharHeight; - buf.H = (Term->ScrollHeight+Count) * giVT_CharHeight; } + buf.H = (Term->ScrollHeight-Count) * giVT_CharHeight; VFS_WriteAt(giVT_OutputDevHandle, 0, sizeof(buf), &buf); // Restore old mode (this function is only called during text mode) diff --git a/Usermode/Applications/axwin2_src/WM/render.c b/Usermode/Applications/axwin2_src/WM/render.c index 50eca9ea..0ee9e80d 100644 --- a/Usermode/Applications/axwin2_src/WM/render.c +++ b/Usermode/Applications/axwin2_src/WM/render.c @@ -13,6 +13,11 @@ // === IMPORTS === extern void Decorator_RenderWidget(tElement *Element); extern tElement gWM_RootElement; +extern tApplication *gWM_Applications; +extern int giWM_MaxAreaX; +extern int giWM_MaxAreaY; +extern int giWM_MaxAreaW; +extern int giWM_MaxAreaH; // === PROTOTYPES === void WM_UpdateMinDims(tElement *Element); diff --git a/Usermode/Applications/axwin2_src/WM/wm.c b/Usermode/Applications/axwin2_src/WM/wm.c index 1bc8db2c..bb8d7f27 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.c +++ b/Usermode/Applications/axwin2_src/WM/wm.c @@ -136,7 +136,7 @@ tElement *AxWin_CreateAppWindow(tApplication *App, const char *Name) tElement *ret; tWindow *win; - win = calloc(sizeof(tWindow) + 1); + win = calloc(1, sizeof(tWindow) + 1); if(!win) return NULL; ret = &win->Element; diff --git a/Usermode/Applications/axwin2_src/WM/wm.h b/Usermode/Applications/axwin2_src/WM/wm.h index df4f860c..d07d44b0 100644 --- a/Usermode/Applications/axwin2_src/WM/wm.h +++ b/Usermode/Applications/axwin2_src/WM/wm.h @@ -60,7 +60,7 @@ struct sAxWin_Element struct sWindow { int X, Y, W, H; - tImage *Icon; + void *Icon; tWindow *OrderNext; // Render order diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index 9c7eccc6..24919aa0 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -395,19 +395,21 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch //TODO: Set location - #if 1 - if( win == gpCurrentWindow ) { + { int pos = SetCursorPos(giTerminal_Height-2, 0); - printf("\x1B[S"); // Scroll up 1 - printf("[%s] %s\n", Source, Message); + printf("\x1B[T"); // Scroll down 1 (free space below) + #if 1 + if( win == gpCurrentWindow ) { + printf("[%s] %s\n", Source, Message); + } + #else + if(win->Name[0]) + printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message); + else + printf("(status) [%s] %s\n", Source, Message); + #endif SetCursorPos(-1, pos); } - #else - if(win->Name[0]) - printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message); - else - printf("(status) [%s] %s\n", Source, Message); - #endif return ret; } diff --git a/Usermode/include/axwin2/axwin.h b/Usermode/include/axwin2/axwin.h index 5e2a0dde..77db620a 100644 --- a/Usermode/include/axwin2/axwin.h +++ b/Usermode/include/axwin2/axwin.h @@ -100,6 +100,8 @@ enum eElementFlags ELEFLAG_ALIGN_END = 0x200 }; +#define ELEFLAG_WINDOW_MAXIMISED 0x10000 + /** */ enum eElementTypes