{
uint32_t cp;
bytes += ReadUTF8(UTF8Text+bytes, &cp);
- if( Unicode_IsPrinting(cp) )
+ if( Unicode_IsPrinting(cp) ) {
space --;
+ giCurrentCol ++;
+ }
}
Display_int_PushString(bytes, UTF8Text);
void Display_MoveCursor(int RelRow, int RelCol)
{
- UNIMPLIMENTED();
+ if( RelRow < 0 )
+ {
+ for( ; RelRow < 0; RelRow ++ )
+ {
+ uint32_t cp;
+ int delta = ReadUTF8Rev(gasDisplayLines[giCurrentLine], giCurrentLinePos, &cp);
+ if( !Unicode_IsPrinting(cp) )
+ RelRow --;
+ else
+ giCurrentCol --;
+ giCurrentLinePos -= delta;
+ }
+ }
+ else
+ {
+ UNIMPLIMENTED();
+ }
}
void Display_ClearLine(int Dir) // 0: All, 1: Forward, -1: Reverse
if( inc_len > 0 || *Buf == '\x1b' )
{
+ // Handle VT100 (like) escape sequence
int new_bytes = min(MAX_VT100_ESCAPE_LEN - inc_len, Len);
- int ret = 0;
+ int ret = 0, old_inc_len = inc_len;
memcpy(inc_buf + inc_len, Buf, new_bytes);
- inc_len += new_bytes;
- // Handle VT100 (like) escape sequence
- _SysDebug("inc_len = %i, new_bytes = %i", inc_len, new_bytes);
+ inc_len += new_bytes;
if( inc_len <= 1 )
return 1; // Skip 1 character (the '\x1b')
{
case '[': // Multibyte, funtime starts
ret = Term_HandleVT100_Long(inc_len-2, inc_buf+2);
- if( ret > 0 )
+ if( ret > 0 ) {
ret += 2;
+ }
break;
default:
ret = 2;
break;
}
- if( ret != 0 )
+ if( ret != 0 ) {
inc_len = 0;
+ ret -= old_inc_len; // counter cached bytes
+ }
return ret;
}
case '\b':
// TODO: Backspace
Display_MoveCursor(-1, 0);
+ Display_AddText(1, " ");
+ Display_MoveCursor(-1, 0);
return 1;
case '\t':
// TODO: tab (get current cursor pos, space until multiple of 8)
if( !isalpha(c) ) {
// Bother.
_SysDebug("Unexpected char 0x%x in VT100 escape code", c);
- return -1;
+ return 1;
}
if( bQuestionMark )