From 5bdad54a08abf27eec625753262f45351e3266bd Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Fri, 16 Mar 2012 20:38:02 -0400 Subject: [PATCH] Prompt editor now properly parses |T# codes --- mystic/bbs_ansi_menubox.pas | 25 +++++++++++++++++++------ mystic/bbs_cfg_theme.pas | 21 ++++++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/mystic/bbs_ansi_menubox.pas b/mystic/bbs_ansi_menubox.pas index 56f6564..d330739 100644 --- a/mystic/bbs_ansi_menubox.pas +++ b/mystic/bbs_ansi_menubox.pas @@ -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; diff --git a/mystic/bbs_cfg_theme.pas b/mystic/bbs_cfg_theme.pas index 51ee8dc..6119975 100644 --- a/mystic/bbs_cfg_theme.pas +++ b/mystic/bbs_cfg_theme.pas @@ -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);