#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480
#define DEFAULT_SCROLLBACK 2 // 2 Screens of text + current screen
+//#define DEFAULT_SCROLLBACK 0
#define DEFAULT_COLOUR (VT_COL_BLACK|(0xAAA<<16))
#define VT_FLAG_HIDECSR 0x01
case KEY_PGDOWN:
if( gpVT_CurTerm->Flags & VT_FLAG_ALTBUF )
return ;
- if( gpVT_CurTerm->ViewPos < gpVT_CurTerm->Width*gpVT_CurTerm->Height*(giVT_Scrollback-1) )
+ if( gpVT_CurTerm->ViewPos < gpVT_CurTerm->Width*gpVT_CurTerm->Height*(giVT_Scrollback) )
gpVT_CurTerm->ViewPos += gpVT_CurTerm->Width;
else
- gpVT_CurTerm->ViewPos = gpVT_CurTerm->Width*gpVT_CurTerm->Height*(giVT_Scrollback-1);
+ gpVT_CurTerm->ViewPos = gpVT_CurTerm->Width*gpVT_CurTerm->Height*(giVT_Scrollback);
return;
}
}
int height, init_write_pos;
int len, i;
int scroll_top, scroll_height;
-
+
+ // Get buffer pointer and attributes
if( Term->Flags & VT_FLAG_ALTBUF )
{
buf = Term->AltBuf;
else
{
buf = Term->Text;
- height = Term->TextHeight*giVT_Scrollback;
+ height = Term->TextHeight*(giVT_Scrollback+1);
init_write_pos = Term->WritePos;
scroll_top = 0;
scroll_height = height;
}
-
+
+ // Scroll text downwards
if( Count > 0 )
{
int base;
+
+ // Set up
if(Count > scroll_height) Count = scroll_height;
-// Debug("Scroll: Count = %i", Count);
base = Term->TextWidth*(scroll_top + scroll_height - Count);
len = Term->TextWidth*(scroll_height - Count);
// Scroll terminal cache
- memcpy(
+ memmove(
&buf[Term->TextWidth*scroll_top],
&buf[Term->TextWidth*(scroll_top+Count)],
len*sizeof(tVT_Char)
len = Term->TextWidth*(scroll_height - Count);
// Scroll terminal cache
- memcpy(
+ memmove(
&buf[Term->TextWidth*(scroll_top+Count)],
&buf[Term->TextWidth*scroll_top],
len*sizeof(tVT_Char)
extern int memcmp(const void *m1, const void *m2, size_t count);
extern void *memcpy(void *dest, const void *src, size_t count);
extern void *memcpyd(void *dest, const void *src, size_t count);
+extern void *memmove(void *dest, const void *src, size_t len);
extern void *memset(void *dest, int val, size_t count);
extern void *memsetd(void *dest, Uint32 val, size_t count);
/**
EXPORT(UnHex);
EXPORT(SwapEndian16);
EXPORT(SwapEndian32);
+EXPORT(memmove);
// === CODE ===
/**
{
return ((Val&0xFF)<<24) | ((Val&0xFF00)<<8) | ((Val>>8)&0xFF00) | ((Val>>24)&0xFF);
}
+
+void *memmove(void *__dest, const void *__src, size_t len)
+{
+ size_t block_size;
+ char *dest = __dest;
+ const char *src = __src;
+ void *ret = __dest;
+
+ if( (tVAddr)dest > (tVAddr)src + len )
+ return memcpy(dest, src, len);
+ if( (tVAddr)dest + len < (tVAddr)src )
+ return memcpy(dest, src, len);
+
+ if( (tVAddr)dest < (tVAddr)src )
+ block_size = (tVAddr)src - (tVAddr)dest;
+ else
+ block_size = (tVAddr)dest - (tVAddr)src;
+
+ block_size &= ~0xF;
+
+ while(len >= block_size)
+ {
+ memcpy(dest, src, block_size);
+ len -= block_size;
+ dest += block_size;
+ src += block_size;
+ }
+ memcpy(dest, src, len);
+ return ret;
+
+}
+