2012-02-13 16:50:48 -08:00
|
|
|
Unit bbs_Edit_Full;
|
|
|
|
|
|
|
|
{$I M_OPS.PAS}
|
|
|
|
|
|
|
|
Interface
|
|
|
|
|
|
|
|
Function AnsiEditor (Var Lines: SmallInt; WrapPos: Byte; MaxLines: SmallInt; TEdit, Forced: Boolean; Var Subj: String) : Boolean;
|
|
|
|
|
|
|
|
Implementation
|
|
|
|
|
|
|
|
Uses
|
|
|
|
m_Strings,
|
|
|
|
bbs_Common,
|
|
|
|
bbs_Core;
|
|
|
|
|
|
|
|
Procedure Print (S: String);
|
|
|
|
Begin
|
|
|
|
{$IFNDEF UNIX}
|
|
|
|
If Not Session.LocalMode Then Session.io.BufAddStr(S);
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
Screen.WriteStr(S);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure PrintLn (S: String);
|
|
|
|
Begin
|
|
|
|
Print (S + #13#10);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Function AnsiEditor (Var Lines: Integer; WrapPos: Byte; MaxLines: Integer; TEdit, Forced: Boolean; Var Subj: String) : Boolean;
|
|
|
|
Const
|
2012-02-27 14:11:31 -08:00
|
|
|
MaxCutText = 100;
|
|
|
|
Type
|
|
|
|
CutTextPtr = ^CutTextRec;
|
|
|
|
CutTextRec = String[79];
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
2012-02-27 14:11:31 -08:00
|
|
|
WinStart : Byte = 2;
|
|
|
|
WinEnd : Byte = 22;
|
|
|
|
WinText : Byte = 7;
|
|
|
|
InsertMode : Boolean = True;
|
|
|
|
CutPasted : Boolean = False;
|
|
|
|
CutTextPos : Word = 0;
|
2012-03-17 14:16:00 -07:00
|
|
|
CutText : Array[1..MaxCutText] of CutTextPTR;
|
2012-02-13 16:50:48 -08:00
|
|
|
Done : Boolean;
|
|
|
|
Save : Boolean;
|
|
|
|
Ch : Char;
|
|
|
|
CurX : Byte;
|
|
|
|
CurY : Integer;
|
|
|
|
CurLine : Integer;
|
|
|
|
TotalLine : Integer;
|
|
|
|
QuoteCurLine : Integer;
|
|
|
|
QuoteTopPage : Integer;
|
|
|
|
|
|
|
|
Procedure UpdatePosition;
|
|
|
|
Begin
|
|
|
|
If CurLine > TotalLine Then TotalLine := CurLine;
|
|
|
|
If CurX > Length(Session.Msgs.MsgText[CurLine]) Then CurX := Length(Session.Msgs.MsgText[CurLine]) + 1;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.AnsiGotoXY (CurX, CurY);
|
|
|
|
End;
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Procedure TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
|
|
|
A,
|
|
|
|
B : Integer;
|
|
|
|
Begin
|
|
|
|
Session.io.AnsiGotoXY (1, CurY);
|
|
|
|
|
|
|
|
A := CurY;
|
|
|
|
B := CurLine;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
If B <= TotalLine Then Print(Session.Msgs.MsgText[B]);
|
|
|
|
If B <= TotalLine + 1 Then Begin
|
|
|
|
Session.io.AnsiClrEOL;
|
|
|
|
PrintLn('');
|
|
|
|
End;
|
|
|
|
|
|
|
|
Inc (A);
|
|
|
|
Inc (B);
|
|
|
|
Until A > WinEnd;
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Procedure TextRefreshFull;
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
|
|
|
A,
|
|
|
|
B : Integer;
|
|
|
|
Begin
|
|
|
|
CurY := WinStart + 5;
|
|
|
|
B := CurLine - 5;
|
|
|
|
|
|
|
|
If B < 1 Then Begin
|
|
|
|
CurY := WinStart + (5 + B - 1);
|
|
|
|
B := 1;
|
|
|
|
End;
|
|
|
|
|
|
|
|
Session.io.AnsiGotoXY (1, WinStart);
|
|
|
|
|
|
|
|
A := WinStart;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
If B <= TotalLine Then Print(Session.Msgs.MsgText[B]);
|
|
|
|
Session.io.AnsiClrEOL;
|
|
|
|
PrintLn('');
|
|
|
|
Inc (A);
|
|
|
|
Inc (B);
|
|
|
|
Until A > WinEnd;
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure InsertLine (Num: Integer);
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
|
|
|
A : Integer;
|
|
|
|
Begin
|
|
|
|
Inc (TotalLine);
|
|
|
|
|
|
|
|
For A := TotalLine DownTo Num + 1 Do
|
|
|
|
Session.Msgs.MsgText[A] := Session.Msgs.MsgText[A - 1];
|
|
|
|
|
|
|
|
Session.Msgs.MsgText[Num] := '';
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure DeleteLine (Num: Integer);
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
2012-02-21 14:43:26 -08:00
|
|
|
Count : Integer;
|
|
|
|
Begin
|
|
|
|
For Count := Num To TotalLine - 1 Do
|
|
|
|
Session.Msgs.MsgText[Count] := Session.Msgs.MsgText[Count + 1];
|
|
|
|
|
|
|
|
Session.Msgs.MsgText[TotalLine] := '';
|
|
|
|
|
|
|
|
Dec (TotalLine);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure TextReformat;
|
|
|
|
Var
|
|
|
|
OldStr : String;
|
2012-02-13 16:50:48 -08:00
|
|
|
NewStr : String;
|
2012-02-21 14:43:26 -08:00
|
|
|
Line : Integer;
|
2012-02-13 16:50:48 -08:00
|
|
|
A : Integer;
|
2012-02-21 14:43:26 -08:00
|
|
|
NewY : Integer;
|
|
|
|
NewLine : Integer;
|
2012-02-13 16:50:48 -08:00
|
|
|
Moved : Boolean;
|
|
|
|
Begin
|
|
|
|
If TotalLine = MaxLines Then Exit;
|
|
|
|
|
|
|
|
Line := CurLine;
|
|
|
|
OldStr := Session.Msgs.MsgText[Line];
|
|
|
|
NewY := CurY;
|
|
|
|
NewLine := CurLine;
|
|
|
|
Moved := False;
|
|
|
|
|
|
|
|
Repeat
|
2012-02-21 15:38:36 -08:00
|
|
|
If Pos(' ', OldStr) = 0 Then Begin
|
|
|
|
Inc (Line);
|
|
|
|
InsertLine (Line);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Session.Msgs.MsgText[Line] := Copy(OldStr, CurX, Length(OldStr));
|
|
|
|
Session.Msgs.MsgText[Line-1][0] := Chr(CurX - 1);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurX > WrapPos Then Begin
|
|
|
|
Inc (NewLine);
|
|
|
|
Inc (NewY);
|
|
|
|
CurX := 1;
|
|
|
|
End;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If NewY <= WinEnd Then TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
CurY := NewY;
|
|
|
|
CurLine := NewLine;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurY > WinEnd Then TextRefreshFull Else UpdatePosition;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Exit;
|
|
|
|
End Else Begin
|
|
|
|
A := strWrap (OldStr, NewStr, WrapPos);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If (A > 0) And (Not Moved) And (CurX > Length(OldStr) + 1) Then Begin
|
|
|
|
CurX := CurX - A;
|
|
|
|
Moved := True;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Inc (NewLine);
|
|
|
|
Inc (NewY);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
|
|
|
Session.Msgs.MsgText[Line] := OldStr;
|
|
|
|
Inc (Line);
|
|
|
|
|
|
|
|
If (Session.Msgs.MsgText[Line] = '') or ((Pos(' ', Session.Msgs.MsgText[Line]) = 0) And (Length(Session.Msgs.MsgText[Line]) >= WrapPos)) Then Begin
|
|
|
|
InsertLine(Line);
|
|
|
|
OldStr := NewStr;
|
|
|
|
End Else
|
|
|
|
OldStr := NewStr + ' ' + Session.Msgs.MsgText[Line];
|
|
|
|
End;
|
2012-02-13 16:50:48 -08:00
|
|
|
Until Length(OldStr) <= WrapPos;
|
|
|
|
|
|
|
|
Session.Msgs.MsgText[Line] := OldStr;
|
|
|
|
|
|
|
|
If NewY <= WinEnd Then Begin
|
|
|
|
Session.io.AnsiGotoXY(1, CurY);
|
|
|
|
|
|
|
|
A := CurLine;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
If (CurY + (A - CurLine) <= WinEnd) and (A <= TotalLine) Then Begin
|
|
|
|
Print(Session.Msgs.MsgText[A]);
|
|
|
|
Session.io.AnsiClrEOL;
|
|
|
|
PrintLn('');
|
|
|
|
End Else
|
|
|
|
Break;
|
|
|
|
|
|
|
|
Inc (A);
|
|
|
|
Until False;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Session.io.BufFlush;
|
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
CurY := NewY;
|
|
|
|
CurLine := NewLine;
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurY > WinEnd Then TextRefreshFull Else UpdatePosition;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure keyEnter;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If TotalLine = MaxLines Then Exit;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
InsertLine (CurLine + 1);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin
|
|
|
|
Session.Msgs.MsgText[CurLine+1] := Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine]));
|
|
|
|
Delete (Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine]));
|
|
|
|
End;
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurY + 1 > WinEnd Then TextRefreshFull Else TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
CurX := 1;
|
|
|
|
|
|
|
|
Inc(CurY);
|
|
|
|
Inc(CurLine);
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure keyDownArrow;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If CurLine = TotalLine Then Exit;
|
|
|
|
|
|
|
|
If CurY = WinEnd Then
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshFull
|
2012-02-13 16:50:48 -08:00
|
|
|
Else Begin
|
|
|
|
Inc (CurY);
|
|
|
|
Inc (CurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 23:31:05 -08:00
|
|
|
Procedure keyUpArrow (MoveToEOL: Boolean);
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If CurLine > 1 Then Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
If MoveToEOL Then Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
|
|
|
If CurX > WrapPos Then CurX := WrapPos + 1;
|
|
|
|
End;
|
|
|
|
|
|
|
|
If CurY = WinStart Then
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshFull
|
2012-02-13 16:50:48 -08:00
|
|
|
Else Begin
|
|
|
|
Dec (CurY);
|
|
|
|
Dec (CurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure keyBackspace;
|
2012-02-13 16:50:48 -08:00
|
|
|
Var
|
2012-02-21 23:31:05 -08:00
|
|
|
Count : Integer;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If CurX > 1 Then Begin
|
|
|
|
Session.io.OutBS(1, True);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
|
|
|
Dec (CurX);
|
2012-02-13 16:50:48 -08:00
|
|
|
Delete (Session.Msgs.MsgText[CurLine], CurX, 1);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin
|
|
|
|
Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])) + ' ');
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
End Else
|
|
|
|
If CurLine > 1 Then Begin
|
|
|
|
If Length(Session.Msgs.MsgText[CurLine - 1]) + Length(Session.Msgs.MsgText[CurLine]) <= WrapPos Then Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Session.Msgs.MsgText[CurLine];
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
DeleteLine (CurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
Dec (CurLine);
|
|
|
|
Dec (CurY);
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurY < WinStart Then TextRefreshFull Else TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
End Else
|
|
|
|
If Pos(' ', Session.Msgs.MsgText[CurLine]) > 0 Then Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
|
|
|
|
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
|
2012-02-13 16:50:48 -08:00
|
|
|
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurY < WinStart Then TextRefreshFull Else TextRefreshPart;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Exit;
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
keyUpArrow(True);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure keyLeftArrow;
|
2012-02-21 23:31:05 -08:00
|
|
|
Begin
|
|
|
|
If CurX > 1 Then Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
Dec (CurX);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdatePosition;
|
2012-02-21 23:31:05 -08:00
|
|
|
End Else
|
|
|
|
keyUpArrow(True);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure keyRightArrow;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
Inc (CurX);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdatePosition;
|
2012-02-21 14:43:26 -08:00
|
|
|
End Else Begin
|
|
|
|
If CurY < TotalLine Then CurX := 1;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
keyDownArrow;
|
|
|
|
End;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-21 23:31:05 -08:00
|
|
|
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;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure AddChar (Ch: Char);
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If InsertMode Then Begin
|
|
|
|
Insert (Ch, Session.Msgs.MsgText[Curline], CurX);
|
2012-02-21 15:38:36 -08:00
|
|
|
Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])));
|
2012-02-13 16:50:48 -08:00
|
|
|
End Else Begin
|
2012-02-21 15:38:36 -08:00
|
|
|
If CurX > Length(Session.Msgs.MsgText[CurLine]) Then
|
|
|
|
Inc(Session.Msgs.MsgText[CurLine][0]);
|
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.Msgs.MsgText[CurLine][CurX] := Ch;
|
2012-02-21 15:38:36 -08:00
|
|
|
Print (Ch);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Inc (CurX);
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure ToggleInsert (Toggle: Boolean);
|
|
|
|
Begin
|
|
|
|
If Toggle Then InsertMode := Not InsertMode;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Session.io.AnsiColor (Session.io.ScreenInfo[3].A);
|
|
|
|
Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[3].Y);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
If InsertMode Then Print('INS') else Print('OVR'); { ++lang }
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Session.io.AnsiGotoXY (CurX, CurY);
|
|
|
|
Session.io.AnsiColor (WinText);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Procedure FullReDraw;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
If TEdit Then Session.io.OutFile ('ansitext', True, 0) Else Session.io.OutFile ('ansiedit', True, 0);
|
|
|
|
|
|
|
|
WinStart := Session.io.ScreenInfo[1].Y;
|
|
|
|
WinEnd := Session.io.ScreenInfo[2].Y;
|
2012-02-21 15:38:36 -08:00
|
|
|
WinText := Session.io.ScreenInfo[1].A;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
ToggleInsert (False);
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshFull;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure Quote;
|
|
|
|
Var
|
2012-02-21 23:31:05 -08:00
|
|
|
InFile : Text;
|
|
|
|
Start : Integer;
|
|
|
|
Finish : Integer;
|
2012-02-13 16:50:48 -08:00
|
|
|
NumLines : Integer;
|
2012-02-21 23:31:05 -08:00
|
|
|
Text : Array[1..mysMaxMsgLines] of String[80];
|
|
|
|
PI1 : String;
|
|
|
|
PI2 : String;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
|
|
|
Assign (InFile, Session.TempPath + 'msgtmp');
|
|
|
|
{$I-} Reset (InFile); {$I+}
|
|
|
|
If IoResult <> 0 Then Begin
|
|
|
|
Session.io.OutFullLn (Session.GetPrompt(158));
|
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
NumLines := 0;
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.AllowPause := True;
|
|
|
|
|
|
|
|
While Not Eof(InFile) Do Begin
|
|
|
|
Inc (NumLines);
|
|
|
|
ReadLn (InFile, Text[NumLines]);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Close (InFile);
|
|
|
|
|
|
|
|
PI1 := Session.io.PromptInfo[1];
|
|
|
|
PI2 := Session.io.PromptInfo[2];
|
|
|
|
|
|
|
|
Session.io.OutFullLn(Session.GetPrompt(452));
|
|
|
|
|
|
|
|
For Start := 1 to NumLines Do Begin
|
|
|
|
Session.io.PromptInfo[1] := strI2S(Start);
|
|
|
|
Session.io.PromptInfo[2] := Text[Start];
|
|
|
|
|
|
|
|
Session.io.OutFullLn (Session.GetPrompt(341));
|
|
|
|
|
|
|
|
If (Session.io.PausePtr >= Session.User.ThisUser.ScreenSize) and (Session.io.AllowPause) Then
|
|
|
|
Case Session.io.MorePrompt of
|
|
|
|
'N' : Break;
|
|
|
|
'C' : Session.io.AllowPause := False;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
|
|
|
|
Session.io.AllowPause := True;
|
|
|
|
|
|
|
|
Session.io.OutFull (Session.GetPrompt(159));
|
|
|
|
Start := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
|
|
|
|
|
|
Session.io.OutFull (Session.GetPrompt(160));
|
|
|
|
Finish := strS2I(Session.io.GetInput(3, 3, 11, ''));
|
|
|
|
|
|
|
|
If (Start > 0) and (Start <= NumLines) and (Finish <= NumLines) Then Begin
|
|
|
|
If Finish = 0 Then Finish := Start;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
For NumLines := Start to Finish Do Begin
|
|
|
|
If TotalLine = mysMaxMsgLines Then Break;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If Session.Msgs.MsgText[CurLine] <> '' Then Begin
|
|
|
|
Inc (CurLine);
|
2012-02-21 14:43:26 -08:00
|
|
|
InsertLine (CurLine);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.Msgs.MsgText[CurLine] := Text[NumLines];
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If CurLine < MaxLines then Inc(CurLine);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Session.io.PromptInfo[1] := PI1;
|
|
|
|
Session.io.PromptInfo[2] := PI2;
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure QuoteWindow;
|
|
|
|
Var
|
|
|
|
QText : Array[1..mysMaxMsgLines] of String[80];
|
|
|
|
InFile : Text;
|
|
|
|
QuoteLines : Integer;
|
|
|
|
NoMore : Boolean;
|
|
|
|
|
|
|
|
Procedure UpdateBar (On: Boolean);
|
|
|
|
Begin
|
|
|
|
Session.io.AnsiGotoXY (1, QuoteCurLine + Session.io.ScreenInfo[2].Y);
|
|
|
|
If On Then
|
|
|
|
Session.io.AnsiColor (Session.Lang.QuoteColor)
|
|
|
|
Else
|
|
|
|
Session.io.AnsiColor (Session.io.ScreenInfo[2].A);
|
|
|
|
|
|
|
|
Print (strPadR(QText[QuoteTopPage + QuoteCurLine], 79, ' '));
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure UpdateWindow;
|
|
|
|
Var
|
2012-02-21 23:31:05 -08:00
|
|
|
Count : Integer;
|
2012-02-13 16:50:48 -08:00
|
|
|
Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
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]);
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.AnsiClrEOL;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
|
|
|
If Count <= QuoteLines Then PrintLn('');
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdateBar(True);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Var
|
|
|
|
Scroll : Integer;
|
|
|
|
Temp1 : Integer;
|
|
|
|
Ch : Char;
|
|
|
|
Added : Boolean;
|
|
|
|
Begin
|
|
|
|
Added := False;
|
|
|
|
|
|
|
|
Assign (InFile, Session.TempPath + 'msgtmp');
|
|
|
|
{$I-} Reset(InFile); {$I+}
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If IoResult <> 0 Then Exit;
|
|
|
|
|
|
|
|
QuoteLines := 0;
|
|
|
|
NoMore := False;
|
|
|
|
Scroll := CurLine + 4;
|
|
|
|
|
|
|
|
While Not Eof(InFile) Do Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
Inc (QuoteLines);
|
2012-02-13 16:50:48 -08:00
|
|
|
ReadLn (InFile, QText[QuoteLines]);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Close (InFile);
|
|
|
|
|
|
|
|
Session.io.OutFile ('ansiquot', True, 0);
|
|
|
|
|
|
|
|
If CurY >= Session.io.ScreenInfo[1].Y Then Begin
|
2012-02-21 15:38:36 -08:00
|
|
|
Session.io.AnsiColor(WinText);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Temp1 := WinEnd;
|
|
|
|
WinEnd := Session.io.ScreenInfo[1].Y;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshFull;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
WinEnd := Temp1;
|
|
|
|
End;
|
|
|
|
|
|
|
|
UpdateWindow;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
Ch := Session.io.GetKey;
|
|
|
|
|
|
|
|
If Session.io.IsArrow Then Begin
|
|
|
|
Case Ch of
|
|
|
|
#71 : If QuoteCurLine > 0 Then Begin
|
|
|
|
QuoteTopPage := 1;
|
|
|
|
QuoteCurLine := 0;
|
|
|
|
UpdateWindow;
|
|
|
|
End;
|
|
|
|
#72 : Begin
|
|
|
|
If QuoteCurLine > 0 Then Begin
|
|
|
|
UpdateBar(False);
|
|
|
|
Dec(QuoteCurLine);
|
|
|
|
UpdateBar(True);
|
|
|
|
End Else
|
|
|
|
If QuoteTopPage > 1 Then Begin
|
|
|
|
Dec (QuoteTopPage);
|
|
|
|
UpdateWindow;
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
NoMore := False;
|
|
|
|
End;
|
|
|
|
#73,
|
|
|
|
#75 : Begin
|
|
|
|
If QuoteTopPage > 6 Then
|
|
|
|
Dec (QuoteTopPage, 6)
|
|
|
|
Else Begin
|
|
|
|
QuoteTopPage := 1;
|
|
|
|
QuoteCurLine := 0;
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
NoMore := False;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdateWindow;
|
|
|
|
End;
|
|
|
|
#79 : Begin
|
|
|
|
If QuoteLines <= 6 Then
|
|
|
|
QuoteCurLine := QuoteLines - QuoteTopPage
|
|
|
|
Else Begin
|
|
|
|
QuoteTopPage := QuoteLines - 5;
|
|
|
|
QuoteCurLine := 5;
|
|
|
|
End;
|
|
|
|
|
|
|
|
UpdateWindow;
|
|
|
|
End;
|
|
|
|
#80 : If QuoteTopPage + QuoteCurLine < QuoteLines Then Begin
|
|
|
|
If QuoteCurLine = 5 Then Begin
|
|
|
|
Inc (QuoteTopPage);
|
|
|
|
UpdateWindow;
|
|
|
|
End Else Begin
|
|
|
|
UpdateBar(False);
|
|
|
|
Inc (QuoteCurLine);
|
|
|
|
UpdateBar(True);
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
#77,
|
|
|
|
#81 : Begin
|
|
|
|
If QuoteLines <= 6 Then
|
|
|
|
QuoteCurLine := QuoteLines - QuoteTopPage
|
|
|
|
Else
|
|
|
|
If QuoteTopPage + 6 < QuoteLines - 6 Then
|
|
|
|
Inc (QuoteTopPage, 6)
|
|
|
|
Else Begin
|
|
|
|
QuoteTopPage := QuoteLines - 5;
|
|
|
|
QuoteCurLine := 5;
|
|
|
|
End;
|
|
|
|
|
|
|
|
UpdateWindow;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
End Else
|
|
|
|
Case Ch of
|
|
|
|
#27 : Break;
|
|
|
|
#13 : If (TotalLine < mysMaxMsgLines) and (Not NoMore) Then Begin
|
|
|
|
Added := True;
|
|
|
|
|
|
|
|
If QuoteTopPage + QuoteCurLine = QuoteLines Then NoMore := True;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
InsertLine (CurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.Msgs.MsgText[CurLine] := QText[QuoteTopPage + QuoteCurLine];
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Inc (CurLine);
|
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
Session.io.AnsiColor(WinText);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
Temp1 := WinEnd;
|
|
|
|
WinEnd := Session.io.ScreenInfo[1].Y;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If CurLine - Scroll + WinStart + 4 >= WinEnd Then Begin
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshFull;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Scroll := CurLine;
|
|
|
|
End Else Begin
|
|
|
|
Dec (CurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshPart;
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Inc (CurLine);
|
|
|
|
Inc (CurY);
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
WinEnd := Temp1;
|
|
|
|
|
|
|
|
If QuoteTopPage + QuoteCurLine < QuoteLines Then
|
|
|
|
If QuoteCurLine = 5 Then Begin
|
|
|
|
Inc (QuoteTopPage);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdateWindow;
|
|
|
|
End Else Begin
|
|
|
|
UpdateBar(False);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Inc (QuoteCurLine);
|
2012-02-21 23:31:05 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
UpdateBar(True);
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
Until False;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.OutFull('|16');
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If (CurLine < mysMaxMsgLines) And Added Then Inc(CurLine);
|
|
|
|
End;
|
|
|
|
|
|
|
|
Procedure Commands;
|
|
|
|
Var
|
|
|
|
Ch : Char;
|
|
|
|
Str : String;
|
|
|
|
Begin
|
|
|
|
Done := False;
|
|
|
|
Save := False;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
Session.io.OutFull (Session.GetPrompt(354));
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Ch := Session.io.OneKey ('?ACHQRSTU', True);
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Case Ch of
|
|
|
|
'?' : Session.io.OutFullLn (Session.GetPrompt(355));
|
|
|
|
'A' : If Forced Then Begin
|
|
|
|
Session.io.OutFull (Session.GetPrompt(307));
|
|
|
|
Exit;
|
|
|
|
End Else Begin
|
|
|
|
Done := Session.io.GetYN(Session.GetPrompt(356), False);
|
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
'C' : Exit;
|
|
|
|
'H' : Begin
|
|
|
|
Session.io.OutFile ('fshelp', True, 0);
|
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
'Q' : Begin
|
|
|
|
If Session.User.ThisUser.UseLBQuote Then
|
|
|
|
QuoteWindow
|
|
|
|
Else
|
|
|
|
Quote;
|
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
'R' : Exit;
|
|
|
|
'S' : Begin
|
|
|
|
Save := True;
|
|
|
|
Done := True;
|
|
|
|
End;
|
|
|
|
'T' : Begin
|
|
|
|
Session.io.OutFull(Session.GetPrompt(463));
|
|
|
|
Str := Session.io.GetInput(60, 60, 11, Subj);
|
|
|
|
If Str <> '' Then Subj := Str;
|
|
|
|
Session.io.PromptInfo[2] := Subj;
|
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
'U' : Begin
|
|
|
|
Session.Msgs.MessageUpload(CurLine);
|
|
|
|
TotalLine := CurLine;
|
2012-06-29 00:10:15 -07:00
|
|
|
|
|
|
|
FullReDraw;
|
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Exit;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
Until Done;
|
|
|
|
End;
|
|
|
|
|
|
|
|
Var
|
|
|
|
A : Integer;
|
|
|
|
Begin
|
|
|
|
QuoteCurLine := 0;
|
|
|
|
QuoteTopPage := 1;
|
2012-02-21 14:43:26 -08:00
|
|
|
CurLine := Lines;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
If Lines = 0 Then CurLine := 1;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
|
|
|
Done := False;
|
|
|
|
CurX := 1;
|
|
|
|
CurY := WinStart;
|
2012-02-13 16:50:48 -08:00
|
|
|
TotalLine := CurLine;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Dec (WrapPos);
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-23 16:45:03 -08:00
|
|
|
For A := Lines + 1 to mysMaxMsgLines Do Session.Msgs.MsgText[A] := '';
|
2012-02-13 16:50:48 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
FullReDraw;
|
2012-02-13 16:50:48 -08:00
|
|
|
|
|
|
|
Session.io.AllowArrow := True;
|
|
|
|
|
|
|
|
Repeat
|
|
|
|
Ch := Session.io.GetKey;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
If Session.io.IsArrow Then Begin
|
|
|
|
Case Ch of
|
|
|
|
#71 : Begin
|
|
|
|
CurX := 1;
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
#72 : keyUpArrow(False);
|
|
|
|
#73 : keyPageUp;
|
|
|
|
#75 : keyLeftArrow;
|
|
|
|
#77 : keyRightArrow;
|
|
|
|
#79 : keyEnd;
|
|
|
|
#80 : keyDownArrow;
|
|
|
|
#81 : keyPageDown;
|
|
|
|
#82 : ToggleInsert(True);
|
2012-02-13 16:50:48 -08:00
|
|
|
#83 : If CurX <= Length(Session.Msgs.MsgText[CurLine]) Then Begin
|
|
|
|
Delete (Session.Msgs.MsgText[CurLine], CurX, 1);
|
|
|
|
Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])) + ' ');
|
|
|
|
UpdatePosition;
|
|
|
|
End Else
|
|
|
|
If CurLine < TotalLine Then
|
|
|
|
If (Session.Msgs.MsgText[CurLine] = '') and (TotalLine > 1) Then Begin
|
2012-02-21 14:43:26 -08:00
|
|
|
DeleteLine (CurLine);
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
End Else
|
|
|
|
If TotalLine > 1 Then
|
|
|
|
If Length(Session.Msgs.MsgText[CurLine]) + Length(Session.Msgs.MsgText[CurLine + 1]) <= WrapPos Then Begin
|
|
|
|
Session.Msgs.MsgText[CurLine] := Session.Msgs.MsgText[CurLine] + Session.Msgs.MsgText[CurLine + 1];
|
2012-02-21 14:43:26 -08:00
|
|
|
DeleteLine (CurLine + 1);
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
End Else
|
|
|
|
For A := Length(Session.Msgs.MsgText[CurLine + 1]) DownTo 1 Do
|
|
|
|
If (Session.Msgs.MsgText[CurLine + 1][A] = ' ') and (Length(Session.Msgs.MsgText[CurLine]) + A <= WrapPos) Then Begin
|
|
|
|
Session.Msgs.MsgText[CurLine] := Session.Msgs.MsgText[CurLine] + Copy(Session.Msgs.MsgText[CurLine + 1], 1, A - 1);
|
|
|
|
Delete (Session.Msgs.MsgText[CurLine + 1], 1, A);
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
End;
|
|
|
|
End Else
|
|
|
|
Case Ch of
|
|
|
|
^A : Begin
|
|
|
|
Done := True;
|
|
|
|
Save := False;
|
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
^B : FullReDraw;
|
|
|
|
^D : keyRightArrow;
|
|
|
|
^E : keyUpArrow(False);
|
|
|
|
^F : Begin
|
|
|
|
CurX := 1;
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
^G : keyEnd;
|
|
|
|
^H : keyBackspace;
|
|
|
|
^I : If CurX <= WrapPos Then Begin
|
|
|
|
Repeat
|
|
|
|
If (CurX < WrapPos) and (CurX = Length(Session.Msgs.MsgText[CurLine]) + 1) Then
|
|
|
|
Session.Msgs.MsgText[CurLine] := Session.Msgs.MsgText[CurLine] + ' ';
|
|
|
|
|
|
|
|
Inc (CurX);
|
|
|
|
Until (CurX MOD 5 = 0) or (CurX = WrapPos);
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
|
|
|
^J : Begin
|
|
|
|
Session.Msgs.MsgText[CurLine] := '';
|
|
|
|
|
|
|
|
CurX := 1;
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
|
|
|
|
Session.io.AnsiClrEOL;
|
|
|
|
End;
|
2012-02-27 14:11:31 -08:00
|
|
|
^K : Begin
|
|
|
|
If CutPasted Then Begin
|
|
|
|
For A := CutTextPos DownTo 1 Do
|
|
|
|
Dispose (CutText[A]);
|
|
|
|
|
|
|
|
CutTextPos := 0;
|
|
|
|
CutPasted := False;
|
|
|
|
End;
|
|
|
|
|
|
|
|
If CutTextPos < MaxCutText Then Begin
|
|
|
|
Inc (CutTextPos);
|
|
|
|
|
|
|
|
New (CutText[CutTextPos]);
|
|
|
|
|
|
|
|
CutText[CutTextPos]^ := Session.Msgs.MsgText[CurLine];
|
|
|
|
|
|
|
|
DeleteLine(CurLine);
|
|
|
|
|
|
|
|
TextRefreshPart;
|
|
|
|
End;
|
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
^L,
|
|
|
|
^M : Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.PurgeInputBuffer;
|
2012-02-21 14:43:26 -08:00
|
|
|
keyEnter;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
^N : keyPageDown;
|
|
|
|
^O : Begin
|
|
|
|
Session.io.OutFile('fshelp', True, 0);
|
|
|
|
FullReDraw;
|
|
|
|
End;
|
|
|
|
^P : keyPageUp;
|
2012-02-13 16:50:48 -08:00
|
|
|
^Q : Begin
|
|
|
|
If Session.User.ThisUser.UseLBQuote Then
|
|
|
|
QuoteWindow
|
|
|
|
Else
|
|
|
|
Quote;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
|
|
|
FullReDraw;
|
|
|
|
End;
|
2012-02-27 14:11:31 -08:00
|
|
|
^R : Begin
|
|
|
|
While CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Do Begin
|
|
|
|
Inc (CurX);
|
|
|
|
|
|
|
|
If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Begin
|
|
|
|
If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Inc(CurX);
|
|
|
|
Break;
|
|
|
|
End;
|
|
|
|
End;
|
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
^T : Begin
|
|
|
|
While CurX > 1 Do Begin
|
|
|
|
Dec (CurX);
|
2012-02-21 14:43:26 -08:00
|
|
|
|
2012-02-21 15:38:36 -08:00
|
|
|
If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break;
|
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
|
|
|
UpdatePosition;
|
|
|
|
End;
|
2012-02-27 14:11:31 -08:00
|
|
|
^U : If CutTextPos > 0 Then Begin
|
|
|
|
CutPasted := True;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
2012-02-27 14:11:31 -08:00
|
|
|
For A := CutTextPos DownTo 1 Do
|
|
|
|
If TotalLine < mysMaxMsgLines Then Begin
|
|
|
|
InsertLine(CurLine);
|
|
|
|
Session.Msgs.MsgText[CurLine] := CutText[A]^;
|
2012-02-21 14:43:26 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-27 14:11:31 -08:00
|
|
|
TextRefreshPart;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
^V : ToggleInsert (True);
|
2012-02-21 23:31:05 -08:00
|
|
|
^W : While (CurX > 1) Do Begin
|
|
|
|
keyBackSpace;
|
|
|
|
If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break;
|
|
|
|
End;
|
2012-02-21 14:43:26 -08:00
|
|
|
^X : keyDownArrow;
|
|
|
|
^Y : Begin
|
2012-02-21 23:31:05 -08:00
|
|
|
DeleteLine (CurLine);
|
2012-02-21 15:38:36 -08:00
|
|
|
TextRefreshPart;
|
2012-02-21 14:43:26 -08:00
|
|
|
End;
|
|
|
|
^[ : Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
Commands;
|
2012-02-21 14:43:26 -08:00
|
|
|
|
|
|
|
If (Not Save) and (Not Done) Then FullReDraw;
|
|
|
|
|
|
|
|
Session.io.AllowArrow := True;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
#32..
|
|
|
|
#254: Begin
|
|
|
|
If Length(Session.Msgs.MsgText[CurLine]) >= WrapPos Then begin
|
|
|
|
If TotalLine < MaxLines Then Begin
|
2012-02-21 14:43:26 -08:00
|
|
|
AddChar (Ch);
|
|
|
|
TextReformat;
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
End Else
|
2012-02-21 14:43:26 -08:00
|
|
|
If (CurX = 1) and (Ch = '/') Then Begin
|
2012-02-13 16:50:48 -08:00
|
|
|
Commands;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
If (Not Save) and (Not Done) Then FullReDraw;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Session.io.AllowArrow := True;
|
2012-02-13 16:50:48 -08:00
|
|
|
End Else
|
2012-02-21 14:43:26 -08:00
|
|
|
AddChar (Ch);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
End;
|
|
|
|
Until Done;
|
|
|
|
|
|
|
|
Session.io.AllowArrow := False;
|
|
|
|
|
|
|
|
If Save Then Begin
|
|
|
|
A := TotalLine;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
While (Session.Msgs.MsgText[A] = '') and (A > 1) Do Begin
|
2012-02-28 13:18:51 -08:00
|
|
|
Dec (A);
|
|
|
|
Dec (TotalLine);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
2012-02-21 15:38:36 -08:00
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Lines := TotalLine;
|
|
|
|
End;
|
|
|
|
|
2012-02-21 14:43:26 -08:00
|
|
|
Result := (Save = True);
|
|
|
|
|
2012-02-13 16:50:48 -08:00
|
|
|
Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize);
|
2012-02-27 14:11:31 -08:00
|
|
|
|
|
|
|
For A := CutTextPos DownTo 1 Do
|
|
|
|
Dispose (CutText[A]);
|
2012-02-13 16:50:48 -08:00
|
|
|
End;
|
|
|
|
|
2012-02-28 13:18:51 -08:00
|
|
|
End.
|