diff --git a/mystic/bbs_edit_full.pas b/mystic/bbs_edit_full.pas index 3177b0d..2171e7c 100644 --- a/mystic/bbs_edit_full.pas +++ b/mystic/bbs_edit_full.pas @@ -248,14 +248,15 @@ Begin Else Begin Inc (CurY); Inc (CurLine); + UpdatePosition; End; End; -Procedure keyUpArrow (EOL: Boolean); +Procedure keyUpArrow (MoveToEOL: Boolean); Begin If CurLine > 1 Then Begin - If EOL then begin + If MoveToEOL Then Begin CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1; If CurX > WrapPos Then CurX := WrapPos + 1; End; @@ -265,6 +266,7 @@ Begin Else Begin Dec (CurY); Dec (CurLine); + UpdatePosition; End; End; @@ -272,12 +274,14 @@ End; Procedure keyBackspace; Var - A : Integer; + Count : Integer; Begin If CurX > 1 Then Begin Session.io.OutBS(1, True); - Dec (CurX); + + Dec (CurX); Delete (Session.Msgs.MsgText[CurLine], CurX, 1); + If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])) + ' '); UpdatePosition; @@ -285,22 +289,31 @@ Begin End Else If CurLine > 1 Then Begin If Length(Session.Msgs.MsgText[CurLine - 1]) + Length(Session.Msgs.MsgText[CurLine]) <= WrapPos Then Begin + CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1; + Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Session.Msgs.MsgText[CurLine]; + DeleteLine (CurLine); - Dec (CurLine); - Dec (CurY); + Dec (CurLine); + Dec (CurY); + If CurY < WinStart Then TextRefreshFull Else TextRefreshPart; End Else If Pos(' ', Session.Msgs.MsgText[CurLine]) > 0 Then Begin - For A := Length(Session.Msgs.MsgText[CurLine]) DownTo 1 Do - If (Session.Msgs.MsgText[CurLine][A] = ' ') and (Length(Session.Msgs.MsgText[CurLine - 1]) + A - 1 <= WrapPos) Then Begin + + For Count := Length(Session.Msgs.MsgText[CurLine]) DownTo 1 Do + If (Session.Msgs.MsgText[CurLine][Count] = ' ') and (Length(Session.Msgs.MsgText[CurLine - 1]) + Count - 1 <= WrapPos) Then Begin CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1; - Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Copy(Session.Msgs.MsgText[CurLine], 1, A - 1); - Delete (Session.Msgs.MsgText[CurLine], 1, A); - Dec (CurLine); - Dec (CurY); + + Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Copy(Session.Msgs.MsgText[CurLine], 1, Count - 1); + + Delete (Session.Msgs.MsgText[CurLine], 1, Count); + Dec (CurLine); + Dec (CurY); + If CurY < WinStart Then TextRefreshFull Else TextRefreshPart; + Exit; End; @@ -310,25 +323,62 @@ Begin End; Procedure keyLeftArrow; -begin - if curx > 1 then Begin +Begin + If CurX > 1 Then Begin Dec (CurX); + UpdatePosition; - end else - keyUpArrow(true); + End Else + keyUpArrow(True); End; Procedure keyRightArrow; Begin If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin Inc (CurX); + UpdatePosition; End Else Begin If CurY < TotalLine Then CurX := 1; + keyDownArrow; End; End; +Procedure keyPageUp; +Begin + If CurLine > 1 Then Begin + If LongInt(CurLine - (WinEnd - WinStart)) >= 1 Then + Dec (CurLine, (WinEnd - WinStart)) + Else + CurLine := 1; + + TextRefreshFull; + End; +End; + +Procedure keyPageDown; +Begin + If CurLine < TotalLine Then Begin + + If CurLine + (WinEnd - WinStart) <= TotalLine Then + Inc (CurLine, (WinEnd - WinStart)) + Else + CurLine := TotalLine; + + TextRefreshFull; + End; +End; + +Procedure keyEnd; +Begin + CurX := Length(Session.Msgs.MsgText[CurLine]) + 1; + + If CurX > WrapPos Then CurX := WrapPos + 1; + + UpdatePosition; +End; + Procedure AddChar (Ch: Char); Begin If InsertMode Then Begin @@ -375,13 +425,13 @@ End; Procedure Quote; Var - InFile : Text; - Start, - Finish : Integer; + InFile : Text; + Start : Integer; + Finish : Integer; NumLines : Integer; - Text : Array[1..mysMaxMsgLines] of String[80]; - PI1 : String; - PI2 : String; + Text : Array[1..mysMaxMsgLines] of String[80]; + PI1 : String; + PI2 : String; Begin Assign (InFile, Session.TempPath + 'msgtmp'); {$I-} Reset (InFile); {$I+} @@ -431,6 +481,7 @@ Begin For NumLines := Start to Finish Do Begin If TotalLine = mysMaxMsgLines Then Break; + If Session.Msgs.MsgText[CurLine] <> '' Then Begin Inc (CurLine); InsertLine (CurLine); @@ -466,15 +517,17 @@ Var Procedure UpdateWindow; Var - A : Integer; + Count : Integer; Begin - Session.io.AnsiGotoXY (1, Session.io.ScreenInfo[2].Y); - Session.io.AnsiColor (Session.io.ScreenInfo[2].A); + Session.io.AnsiGotoXY (1, Session.io.ScreenInfo[2].Y); + Session.io.AnsiColor (Session.io.ScreenInfo[2].A); + + For Count := QuoteTopPage to QuoteTopPage + 5 Do Begin + If Count <= QuoteLines Then Print (QText[Count]); - For A := QuoteTopPage to QuoteTopPage + 5 Do Begin - If A <= QuoteLines Then Print (QText[A]); Session.io.AnsiClrEOL; - If A <= QuoteLines Then PrintLn(''); + + If Count <= QuoteLines Then PrintLn(''); End; UpdateBar(True); @@ -490,6 +543,7 @@ Begin Assign (InFile, Session.TempPath + 'msgtmp'); {$I-} Reset(InFile); {$I+} + If IoResult <> 0 Then Exit; QuoteLines := 0; @@ -497,7 +551,7 @@ Begin Scroll := CurLine + 4; While Not Eof(InFile) Do Begin - Inc (QuoteLines); + Inc (QuoteLines); ReadLn (InFile, QText[QuoteLines]); End; @@ -507,9 +561,12 @@ Begin If CurY >= Session.io.ScreenInfo[1].Y Then Begin Session.io.AnsiColor(WinText); + Temp1 := WinEnd; WinEnd := Session.io.ScreenInfo[1].Y; + TextRefreshFull; + WinEnd := Temp1; End; @@ -595,7 +652,9 @@ Begin If QuoteTopPage + QuoteCurLine = QuoteLines Then NoMore := True; InsertLine (CurLine); + Session.Msgs.MsgText[CurLine] := QText[QuoteTopPage + QuoteCurLine]; + Inc (CurLine); Session.io.AnsiColor(WinText); @@ -605,10 +664,13 @@ Begin If CurLine - Scroll + WinStart + 4 >= WinEnd Then Begin TextRefreshFull; + Scroll := CurLine; End Else Begin Dec (CurLine); + TextRefreshPart; + Inc (CurLine); Inc (CurY); End; @@ -618,10 +680,13 @@ Begin If QuoteTopPage + QuoteCurLine < QuoteLines Then If QuoteCurLine = 5 Then Begin Inc (QuoteTopPage); + UpdateWindow; End Else Begin UpdateBar(False); + Inc (QuoteCurLine); + UpdateBar(True); End; End; @@ -688,40 +753,6 @@ Begin Until Done; End; -Procedure keyPageUp; -Begin - If CurLine > 1 Then Begin - If LongInt(CurLine - (WinEnd - WinStart)) >= 1 Then - Dec (CurLine, (WinEnd - WinStart)) {scroll one page up} - Else - CurLine := 1; - - TextRefreshFull; - End; -End; - -Procedure keyPageDown; -Begin - If CurLine < TotalLine Then Begin - - If CurLine + (WinEnd - WinStart) <= TotalLine Then - Inc (CurLine, (WinEnd - WinStart)) - Else - CurLine := TotalLine; - - TextRefreshFull; - End; -End; - -Procedure keyEnd; -Begin - CurX := Length(Session.Msgs.MsgText[CurLine]) + 1; - - If CurX > WrapPos Then CurX := WrapPos + 1; - - UpdatePosition; -End; - Var A : Integer; Begin @@ -848,10 +879,6 @@ Begin UpdatePosition; End; - ^W : While (CurX > 1) Do Begin - keyBackSpace; - If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break; - End; ^U : Begin While CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Do Begin Inc (CurX); @@ -865,10 +892,13 @@ Begin UpdatePosition; End; ^V : ToggleInsert (True); -// ^W : ; // delete word left + ^W : While (CurX > 1) Do Begin + keyBackSpace; + If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break; + End; ^X : keyDownArrow; ^Y : Begin - DeleteLine (curline); + DeleteLine (CurLine); TextRefreshPart; End; ^[ : Begin @@ -916,4 +946,4 @@ Begin Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize); End; -End. +End. \ No newline at end of file diff --git a/mystic/bbs_general.pas b/mystic/bbs_general.pas index cd90609..de90d30 100644 --- a/mystic/bbs_general.pas +++ b/mystic/bbs_general.pas @@ -40,7 +40,6 @@ Procedure Voting_Booth (Forced: Boolean; Num: Integer); Procedure Voting_Result (Data : Integer); Procedure Voting_Booth_New; Procedure View_History (LastDays: Word); -Function Check_Node_Message : Boolean; Procedure View_Directory (Data: String; ViewType: Byte); Implementation @@ -892,56 +891,6 @@ Begin End; End; -Function Check_Node_Message : Boolean; -Var - Res : Boolean; - Str : String; -Begin - Check_Node_Message := False; - Res := False; - - Assign (NodeMsgFile, Session.TempPath + 'chat.tmp'); - FileMode := 66; - {$I-} Reset (NodeMsgFile); {$I+} - If IoResult <> 0 Then Exit; - -{ checks for non-teleconference node messages: - 2 = system broadcast message (ie, not from user, from mystic) - 3 = user to user node message } - - While Not Eof(NodeMsgFile) Do Begin - Res := True; - - Read (NodeMsgFile, NodeMsg); - - Session.io.PromptInfo[1] := NodeMsg.FromWho; - Session.io.PromptInfo[2] := strI2S(NodeMsg.FromNode); - - Case NodeMsg.MsgType of - 2 : Begin - Session.io.OutFullLn (Session.GetPrompt(179) + NodeMsg.Message); - Session.io.OutFullLn (Session.GetPrompt(180)); - End; - 3 : Begin - Session.io.OutFullLn (Session.GetPrompt(144) + '|CR' + NodeMsg.Message); - Session.io.OutFull (Session.GetPrompt(145)); - End; - End; - End; - - Close (NodeMsgFile); - Erase (NodeMsgFile); - - If Res And (NodeMsg.MsgType = 3) Then - If Session.io.OneKey(#13 + 'R', True) = 'R' Then Begin - Session.io.OutFullLn(Session.GetPrompt(360)); - Str := Session.io.GetInput(79, 79, 11, ''); - If Str <> '' Then Send_Node_Message(3, Session.io.PromptInfo[2] + ';' + Str, 0); - End; - - Check_Node_Message := Res; -End; - Procedure View_Directory (Data: String; ViewType: Byte); Const vtMaxList = 1000; diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index 5d24c49..1faef5b 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -1460,7 +1460,7 @@ Var ReDraw; End; - Procedure Add_Char (Ch : Char); + Procedure AddChar (Ch : Char); Begin If CurPos > Field then ScrollRight; @@ -1487,8 +1487,13 @@ Begin xPos := Screen.CursorX; FieldCh := ' '; + // this is poorly implemented but to expand on it will require MPL + // programs to change. :( we are stuck at the cap for input types + // because of this. + If Mode > 10 Then Begin Dec (Mode, 10); + If UseInField and (Graphics = 1) Then Begin FieldCh := TBBSCore(Core).Lang.FieldChar; AnsiColor (TBBSCore(Core).Lang.FieldCol2); @@ -1523,6 +1528,7 @@ Begin Repeat Ch := GetKey; + If IsArrow Then Begin Case Ch of #71 : If StrPos > 1 Then Begin @@ -1586,8 +1592,9 @@ Begin Case Ch of #02 : ReDraw; #08 : If StrPos > 1 Then Begin - Dec (StrPos); + Dec (StrPos); Delete (S, StrPos, 1); + If CurPos = 1 Then ScrollLeft Else @@ -1613,44 +1620,45 @@ Begin #32.. #254: If Length(S) < Max Then Case Mode of - 1 : Add_Char (Ch); - 2 : Add_Char (UpCase(Ch)); + 1 : AddChar (Ch); + 2 : AddChar (UpCase(Ch)); 3 : Begin If (CurPos = 1) or (S[StrPos-1] in [' ', '.']) Then Ch := UpCase(Ch) Else Ch := LoCase(Ch); - Add_Char(Ch); + + AddChar(Ch); End; 4 : If (Ord(Ch) > 47) and (Ord(Ch) < 58) Then Case StrPos of 4,8 : Begin - Add_Char ('-'); - Add_Char (Ch); + AddChar ('-'); + AddChar (Ch); End; 3,7 : Begin - Add_Char (Ch); - Add_Char ('-'); + AddChar (Ch); + AddChar ('-'); End; Else - Add_Char(Ch); + AddChar(Ch); End; 5 : If (Ord(Ch) > 47) and (Ord(Ch) < 58) Then Case StrPos of 2,5 : Begin - Add_Char (Ch); - Add_Char ('/'); + AddChar (Ch); + AddChar ('/'); End; 3,6 : Begin - Add_Char ('/'); - Add_Char (Ch); + AddChar ('/'); + AddChar (Ch); End; Else - Add_Char (Ch); + AddChar (Ch); End; - 6 : Add_Char(UpCase(Ch)); - 7 : Add_Char(LoCase(Ch)); - 9 : Add_Char(Ch); + 6 : AddChar(UpCase(Ch)); + 7 : AddChar(LoCase(Ch)); + 9 : AddChar(Ch); End; End; Until False; @@ -1729,8 +1737,8 @@ Begin End; End; - Session.io.AnsiColor(Image.CursorA); - Session.io.AnsiGotoXY(Image.CursorX, Image.CursorY); + Session.io.AnsiColor (Image.CursorA); + Session.io.AnsiGotoXY (Image.CursorX, Image.CursorY); Session.io.BufFlush; End; @@ -1761,8 +1769,8 @@ Begin End; End; - Session.io.AnsiColor(Image.CursorA); - Session.io.AnsiGotoXY(Image.CursorX, Image.CursorY); + Session.io.AnsiColor (Image.CursorA); + Session.io.AnsiGotoXY (Image.CursorX, Image.CursorY); Session.io.BufFlush; End; @@ -1821,4 +1829,4 @@ Begin End; {$ENDIF} -End. +End. \ No newline at end of file diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index 35e92cf..3d0a4b9 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -790,7 +790,7 @@ Begin Set_Node_Action (Session.GetPrompt(346)); - Check_Node_Message; + CheckNodeMessages; Keys := #13; ExtKeys := ''; diff --git a/mystic/bbs_msgbase.pas b/mystic/bbs_msgbase.pas index c9f0aad..68abc70 100644 --- a/mystic/bbs_msgbase.pas +++ b/mystic/bbs_msgbase.pas @@ -1400,7 +1400,7 @@ Var Ansi_View_Message := False; Repeat - Check_Node_Message; + CheckNodeMessages; Set_Node_Action (Session.GetPrompt(348)); @@ -1688,7 +1688,7 @@ Var Procedure FullReDraw; Begin - Check_Node_Message; + CheckNodeMessages; Session.io.OutFile ('ansimlst', True, 0); @@ -2017,7 +2017,7 @@ end; Session.io.AllowPause := False; Repeat - Check_Node_Message; + CheckNodeMessages; Session.io.PromptInfo[1] := strI2S(MsgBase^.GetMsgNum); Session.io.PromptInfo[2] := strI2S(MsgBase^.GetHighMsgNum); diff --git a/mystic/bbs_nodeinfo.pas b/mystic/bbs_nodeinfo.pas index efe3102..7f0fc25 100644 --- a/mystic/bbs_nodeinfo.pas +++ b/mystic/bbs_nodeinfo.pas @@ -8,6 +8,7 @@ Function Is_User_Online (Name : String) : Word; Procedure Set_Node_Action (Action: String); Procedure Show_Whos_Online; Procedure Send_Node_Message (MsgType: Byte; Data: String; Room: Byte); +Function CheckNodeMessages : Boolean; Implementation @@ -193,4 +194,53 @@ Begin End; End; +Function CheckNodeMessages : Boolean; +Var + Str : String; +Begin + Result := False; + FileMode := 66; + + Assign (NodeMsgFile, Session.TempPath + 'chat.tmp'); + + {$I-} Reset (NodeMsgFile); {$I+} + + If IoResult <> 0 Then Exit; + + // 2 = system broadcast message (ie, not from user, from mystic) + // 3 = user to user node message + + While Not Eof(NodeMsgFile) Do Begin + Result := True; + + Read (NodeMsgFile, NodeMsg); + + Session.io.PromptInfo[1] := NodeMsg.FromWho; + Session.io.PromptInfo[2] := strI2S(NodeMsg.FromNode); + + Case NodeMsg.MsgType of + 2 : Begin + Session.io.OutFullLn (Session.GetPrompt(179) + NodeMsg.Message); + Session.io.OutFullLn (Session.GetPrompt(180)); + End; + 3 : Begin + Session.io.OutFullLn (Session.GetPrompt(144) + '|CR' + NodeMsg.Message); + Session.io.OutFull (Session.GetPrompt(145)); + End; + End; + End; + + Close (NodeMsgFile); + Erase (NodeMsgFile); + + If Result And (NodeMsg.MsgType = 3) Then + If Session.io.OneKey(#13 + 'R', True) = 'R' Then Begin + Session.io.OutFullLn(Session.GetPrompt(360)); + + Str := Session.io.GetInput(79, 79, 11, ''); + + If Str <> '' Then Send_Node_Message(3, Session.io.PromptInfo[2] + ';' + Str, 0); + End; +End; + End.