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 If S[Count] = '|' Then Begin
Code := Copy(S, Count + 1, 2); Code := Copy(S, Count + 1, 2);
If (Code[1] in ['0'..'2']) and (Code[2] in ['0'..'9']) Then Begin If (Code[2] in ['0'..'9']) Then Begin
Inc (Count, 2); 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 End Else Begin
Session.io.BufAddChar(S[Count]); Session.io.BufAddChar(S[Count]);
Dec (SZ); Dec (SZ);
@ -131,9 +144,9 @@ Begin
Inc (Count); Inc (Count);
End; End;
While SZ > 0 Do Begin If SZ > 0 Then Begin
Session.io.BufAddChar(' '); Session.io.AnsiColor (7);
Dec(SZ); Session.io.BufAddStr (strRep(' ', SZ));
End; End;
Session.io.BufFlush; Session.io.BufFlush;

View File

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