break;
}
break;
+ default:
+ Log_Warning("VTerm", "Unknown control sequence '\\x1B[?%c'", c);
+ break;
}
}
else
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
break;
default:
- Log_Warning("VTerm", "Unknown control sequence");
+ Log_Warning("VTerm", "Unknown control sequence '\\x1B[%c'", c);
break;
}
}
// 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;
}
}
{
tVT_Char *buf;
int height, init_write_pos;
- int base, len, i;
+ int len, i;
if( Term->Flags & VT_FLAG_ALTBUF )
{
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(
// 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 );
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(
}
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 );
{
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)
\r
//TODO: Set location\r
\r
- #if 1\r
- if( win == gpCurrentWindow ) {\r
+ {\r
int pos = SetCursorPos(giTerminal_Height-2, 0);\r
- printf("\x1B[S"); // Scroll up 1\r
- printf("[%s] %s\n", Source, Message);\r
+ printf("\x1B[T"); // Scroll down 1 (free space below)\r
+ #if 1\r
+ if( win == gpCurrentWindow ) {\r
+ printf("[%s] %s\n", Source, Message);\r
+ }\r
+ #else\r
+ if(win->Name[0])\r
+ printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message);\r
+ else\r
+ printf("(status) [%s] %s\n", Source, Message);\r
+ #endif\r
SetCursorPos(-1, pos);\r
}\r
- #else\r
- if(win->Name[0])\r
- printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message);\r
- else\r
- printf("(status) [%s] %s\n", Source, Message);\r
- #endif\r
\r
return ret;\r
}\r