Prompt editor now properly parses |T# codes

This commit is contained in:
mysticbbs 2012-03-16 20:38:02 -04:00
parent 9981b7bf63
commit 5bdad54a08
2 changed files with 33 additions and 13 deletions

View File

@ -113,10 +113,23 @@ Begin
If S[Count] = '|' Then Begin
Code := Copy(S, Count + 1, 2);
If (Code[1] in ['0'..'2']) and (Code[2] in ['0'..'9']) Then Begin
Inc (Count, 2);
If (Code[2] in ['0'..'9']) Then Begin
Case Code[1] of
'0'..
'2' : Begin
Inc (Count, 2);
Session.io.BufAddStr(Session.io.Pipe2Ansi(strS2I(Code)));
Session.io.BufAddStr(Session.io.Pipe2Ansi(strS2I(Code)));
End;
'T' : Begin
Inc (Count, 2);
Session.io.BufAddStr(Session.io.Attr2Ansi(Session.Lang.Colors[strS2I(Code[2])]));
End;
Else
Session.io.BufAddChar(S[Count]);
Dec (SZ);
End;
End Else Begin
Session.io.BufAddChar(S[Count]);
Dec (SZ);
@ -131,9 +144,9 @@ Begin
Inc (Count);
End;
While SZ > 0 Do Begin
Session.io.BufAddChar(' ');
Dec(SZ);
If SZ > 0 Then Begin
Session.io.AnsiColor (7);
Session.io.BufAddStr (strRep(' ', SZ));
End;
Session.io.BufFlush;

View File

@ -397,13 +397,14 @@ Var
End;
Var
EditStr : String;
UndoStr : String;
CurStr : String[3];
Changed : Boolean = False;
Saved : Boolean = False;
Count : Integer;
Image : TConsoleImageRec;
EditStr : String;
UndoStr : String;
CurStr : String[3];
Changed : Boolean = False;
Saved : Boolean = False;
Count : Integer;
Image : TConsoleImageRec;
SavedTheme : RecTheme;
Begin
Screen.GetScreenImage(1, 1, 79, 24, Image);
@ -414,6 +415,10 @@ Begin
Session.io.AnsiColor(7);
Session.io.AnsiClear;
SavedTheme := Session.Lang;
Move (Theme.Colors, Session.Lang.Colors, SizeOf(Theme.Colors));
Box := TAnsiMenuBox.Create;
Input := TAnsiMenuInput.Create;
@ -547,6 +552,8 @@ Begin
Input.Free;
Session.io.RemoteRestore(Image);
Session.Lang := SavedTheme;
End;
Procedure EditBars (Var Theme: RecTheme);