gasDisplayLines = calloc( sizeof(char*), (Lines + ExtraScrollbackLines) );
gaiDisplayLineSizes = calloc( sizeof(int), (Lines + ExtraScrollbackLines) );
gabDisplayLinesDirty = calloc( sizeof(char), (Lines + ExtraScrollbackLines) );
+
+ AxWin3_RichText_SetLineCount(gMainWindow, Lines+ExtraScrollbackLines);
+ AxWin3_RichText_SetCursorType(gMainWindow, 1); // TODO: enum
}
void Display_int_PushString(int Length, const char *Text)
memcpy(gasDisplayLines[giCurrentLine]+giCurrentLinePos, Text, Length);
gabDisplayLinesDirty[giCurrentLine] = 1;
gasDisplayLines[giCurrentLine][giCurrentLinePos+Length] = 0;
+ giCurrentLinePos += Length;
}
void Display_SetForeground(uint32_t RGB)
{
- UNIMPLIMENTED();
+ char buf[7+1];
+ sprintf(buf, "\1%06x", RGB&0xFFFFFF);
+ Display_int_PushString(7, buf);
}
void Display_SetBackground(uint32_t RGB)
{
- UNIMPLIMENTED();
+ char buf[7+1];
+ sprintf(buf, "\2%06x", RGB&0xFFFFFF);
+ Display_int_PushString(7, buf);
}
void Display_Flush(void)
}
// force redraw?
- AxWin3_FocusWindow(gMainWindow);
+ AxWin3_RichText_SetCursorPos(gMainWindow, giCurrentLine, giCurrentCol);
}
void Display_ShowAltBuffer(int AltBufEnabled)
switch(KeySym)
{
case KEYSYM_LEFTCTRL:
- _bitset(ctrl_state, 0, bPress);
+ _bitset(ctrl_state, 0, bPress!=0);
return 0;
case KEYSYM_RIGHTCTRL:
- _bitset(ctrl_state, 0, bPress);
+ _bitset(ctrl_state, 1, bPress!=0);
return 0;
}
#undef _bitset
Translated = KeySym - KEYSYM_a + 1;
}
- if( Translated )
+ // == 2 :: FIRE
+ if( bPress == 2 )
{
- char buf[6];
- int len;
-
- // Encode and send
- len = WriteUTF8(buf, Translated);
-
- _SysWrite(giChildStdin, buf, len);
+ if( Translated )
+ {
+ char buf[6];
+ int len;
+
+ // Encode and send
+ len = WriteUTF8(buf, Translated);
+
+ _SysDebug("Keystroke translated to '%.*s'", len, buf);
+ _SysWrite(giChildStdin, buf, len);
+
+ return 0;
+ }
- return 0;
- }
-
- // No translation, look for escape sequences to send
- const char *str = NULL;
- switch(KeySym)
- {
- case KEYSYM_LEFTARROW:
- str = "\x1b[D";
- break;
- }
- if( str )
- {
- _SysWrite(giChildStdin, str, strlen(str));
+ // No translation, look for escape sequences to send
+ const char *str = NULL;
+ switch(KeySym)
+ {
+ case KEYSYM_LEFTARROW:
+ str = "\x1b[D";
+ break;
+ }
+ if( str )
+ {
+ _SysWrite(giChildStdin, str, strlen(str));
+ }
}
return 0;
}
#include <ctype.h> // isalpha
#include <acess/sys.h> // _SysDebug
+const uint32_t caVT100Colours[] = {
+ // Black, Red, Green, Yellow, Blue, Purple, Cyan, Gray
+ // Same again, but bright
+ 0x000000, 0x770000, 0x007700, 0x777700, 0x000077, 0x770077, 0x007777, 0xAAAAAAA,
+ 0xCCCCCC, 0xFF0000, 0x00FF00, 0xFFFF00, 0x0000FF, 0xFF00FF, 0x00FFFF, 0xFFFFFFF
+};
+
int Term_HandleVT100_Long(int Len, const char *Buf);
static inline int min(int a, int b)
else
_SysDebug("TODO: VT100 %i J", args[0]);
break;
+ case 'm':
+ if( argc == 0 )
+ {
+ // Reset
+ }
+ else
+ {
+ int i;
+ for( i = 0; i < argc; i ++ )
+ {
+ if( args[i] < 8 )
+ {
+ // Flags?
+ }
+ else if( 30 <= args[i] && args[i] <= 37 )
+ {
+ // TODO: Bold/bright
+ Display_SetForeground( caVT100Colours[ args[i]-30 ] );
+ }
+ else if( 40 <= args[i] && args[i] <= 47 )
+ {
+ // TODO: Bold/bright
+ Display_SetBackground( caVT100Colours[ args[i]-30 ] );
+ }
+ }
+ }
+ break;
default:
_SysDebug("Unknown VT100 escape char 0x%x", c);
break;