New control key options (see history.txt) and some code cleanup
This commit is contained in:
parent
9929810887
commit
fa8c58d162
|
@ -1,30 +1,5 @@
|
||||||
Unit bbs_Edit_Full;
|
Unit bbs_Edit_Full;
|
||||||
|
|
||||||
{ this editor really should be rewritten from scratch again, since i wrote }
|
|
||||||
{ it sooo many years ago. i'm sure i could do a better job now! in any }
|
|
||||||
{ case, some things which could be added or included in new editor: }
|
|
||||||
{ }
|
|
||||||
{ 1. cut/paste line functions }
|
|
||||||
{ 2. move word left/right commands }
|
|
||||||
{ 3. optional spell checker? }
|
|
||||||
{ 4. reformat paragraph command }
|
|
||||||
{ 5. tag lines? }
|
|
||||||
{ 6. ability to show embedded ansi/pipes }
|
|
||||||
{ 7. ability to toggle off word wrap? }
|
|
||||||
{ 8. ability to set foreground/background color }
|
|
||||||
{ 9. ability to change extended character sets }
|
|
||||||
{ 10. maybe remove Squish msgbase support and add a OWNER field to each }
|
|
||||||
{ message. Owners can be assigned by Sysop ACS or the original poster }
|
|
||||||
{ Ownership allows message editing but not deleting. this combined with }
|
|
||||||
{ the above allows artists to collaborate ANSIs in the message bases with}
|
|
||||||
{ the FSE. totally badass feature no one has ever done. }
|
|
||||||
{ CTRL-A = change attribute CTRL-C change character set? CTRL-W on off}
|
|
||||||
{ then ahve a PUBLISH feature which can allow downloads or moving to the}
|
|
||||||
{ ANSI gallery? }
|
|
||||||
{ add SAUCE editor if this happens too }
|
|
||||||
{ how will message quoting work though? has to strip colors }
|
|
||||||
{ hmm what happens if two users want to work together though? }
|
|
||||||
|
|
||||||
{$I M_OPS.PAS}
|
{$I M_OPS.PAS}
|
||||||
|
|
||||||
Interface
|
Interface
|
||||||
|
@ -74,10 +49,11 @@ Procedure UpdatePosition;
|
||||||
Begin
|
Begin
|
||||||
If CurLine > TotalLine Then TotalLine := CurLine;
|
If CurLine > TotalLine Then TotalLine := CurLine;
|
||||||
If CurX > Length(Session.Msgs.MsgText[CurLine]) Then CurX := Length(Session.Msgs.MsgText[CurLine]) + 1;
|
If CurX > Length(Session.Msgs.MsgText[CurLine]) Then CurX := Length(Session.Msgs.MsgText[CurLine]) + 1;
|
||||||
|
|
||||||
Session.io.AnsiGotoXY (CurX, CurY);
|
Session.io.AnsiGotoXY (CurX, CurY);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure ReFresh_Part;
|
Procedure ScreenRefreshPart;
|
||||||
Var
|
Var
|
||||||
A,
|
A,
|
||||||
B : Integer;
|
B : Integer;
|
||||||
|
@ -101,14 +77,11 @@ Begin
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Refresh_Text;
|
Procedure ScreenRefreshFull;
|
||||||
Var
|
Var
|
||||||
A,
|
A,
|
||||||
B : Integer;
|
B : Integer;
|
||||||
Begin
|
Begin
|
||||||
{ b = first line at top of window }
|
|
||||||
{ cury = yposition of last line. }
|
|
||||||
|
|
||||||
CurY := WinStart + 5;
|
CurY := WinStart + 5;
|
||||||
B := CurLine - 5;
|
B := CurLine - 5;
|
||||||
|
|
||||||
|
@ -132,7 +105,7 @@ Begin
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Insert_Line (Num: Integer);
|
Procedure InsertLine (Num: Integer);
|
||||||
Var
|
Var
|
||||||
A : Integer;
|
A : Integer;
|
||||||
Begin
|
Begin
|
||||||
|
@ -144,14 +117,26 @@ Begin
|
||||||
Session.Msgs.MsgText[Num] := '';
|
Session.Msgs.MsgText[Num] := '';
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Format_Text;
|
Procedure DeleteLine (Num: Integer);
|
||||||
Var
|
Var
|
||||||
OldStr : String; { holds the line text to be wrapped }
|
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;
|
||||||
NewStr : String;
|
NewStr : String;
|
||||||
Line : Integer; { holds current line number being wrapped }
|
Line : Integer;
|
||||||
A : Integer;
|
A : Integer;
|
||||||
NewY : Integer; { holds new y position on screen }
|
NewY : Integer;
|
||||||
NewLine : Integer; { holds new line number }
|
NewLine : Integer;
|
||||||
Moved : Boolean;
|
Moved : Boolean;
|
||||||
Begin
|
Begin
|
||||||
If TotalLine = MaxLines Then Exit;
|
If TotalLine = MaxLines Then Exit;
|
||||||
|
@ -164,8 +149,8 @@ Begin
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
If Pos(' ', OldStr) = 0 Then Begin
|
If Pos(' ', OldStr) = 0 Then Begin
|
||||||
Inc (Line);
|
Inc (Line);
|
||||||
Insert_Line (Line);
|
InsertLine (Line);
|
||||||
|
|
||||||
Session.Msgs.MsgText[Line] := Copy(OldStr, CurX, Length(OldStr));
|
Session.Msgs.MsgText[Line] := Copy(OldStr, CurX, Length(OldStr));
|
||||||
Session.Msgs.MsgText[Line-1][0] := Chr(CurX - 1);
|
Session.Msgs.MsgText[Line-1][0] := Chr(CurX - 1);
|
||||||
|
@ -176,12 +161,12 @@ Begin
|
||||||
CurX := 1;
|
CurX := 1;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If NewY <= WinEnd Then Refresh_Part;
|
If NewY <= WinEnd Then ScreenRefreshPart;
|
||||||
|
|
||||||
CurY := NewY;
|
CurY := NewY;
|
||||||
CurLine := NewLine;
|
CurLine := NewLine;
|
||||||
|
|
||||||
If CurY > WinEnd Then Refresh_Text Else UpdatePosition;
|
If CurY > WinEnd Then ScreenRefreshFull Else UpdatePosition;
|
||||||
|
|
||||||
Exit;
|
Exit;
|
||||||
End Else Begin
|
End Else Begin
|
||||||
|
@ -198,7 +183,7 @@ Begin
|
||||||
Inc (Line);
|
Inc (Line);
|
||||||
|
|
||||||
If (Session.Msgs.MsgText[Line] = '') or ((Pos(' ', Session.Msgs.MsgText[Line]) = 0) And (Length(Session.Msgs.MsgText[Line]) >= WrapPos)) Then Begin
|
If (Session.Msgs.MsgText[Line] = '') or ((Pos(' ', Session.Msgs.MsgText[Line]) = 0) And (Length(Session.Msgs.MsgText[Line]) >= WrapPos)) Then Begin
|
||||||
Insert_Line(Line);
|
InsertLine(Line);
|
||||||
OldStr := NewStr;
|
OldStr := NewStr;
|
||||||
End Else
|
End Else
|
||||||
OldStr := NewStr + ' ' + Session.Msgs.MsgText[Line];
|
OldStr := NewStr + ' ' + Session.Msgs.MsgText[Line];
|
||||||
|
@ -224,24 +209,26 @@ Begin
|
||||||
Until False;
|
Until False;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Session.io.BufFlush;
|
||||||
|
|
||||||
CurY := NewY;
|
CurY := NewY;
|
||||||
CurLine := NewLine;
|
CurLine := NewLine;
|
||||||
|
|
||||||
If CurY > WinEnd Then Refresh_Text Else UpdatePosition;
|
If CurY > WinEnd Then ScreenRefreshFull Else UpdatePosition;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Do_Enter;
|
Procedure keyEnter;
|
||||||
Begin
|
Begin
|
||||||
If TotalLine = MaxLines Then Exit;
|
If TotalLine = MaxLines Then Exit;
|
||||||
|
|
||||||
Insert_Line (CurLine + 1);
|
InsertLine (CurLine + 1);
|
||||||
|
|
||||||
If CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Then Begin
|
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]));
|
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]));
|
Delete (Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine]));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If CurY + 1 > WinEnd Then Refresh_Text Else Refresh_Part;
|
If CurY + 1 > WinEnd Then ScreenRefreshFull Else ScreenRefreshPart;
|
||||||
|
|
||||||
CurX := 1;
|
CurX := 1;
|
||||||
|
|
||||||
|
@ -251,12 +238,12 @@ Begin
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Down_Key;
|
Procedure keyDownArrow;
|
||||||
Begin
|
Begin
|
||||||
If CurLine = TotalLine Then Exit;
|
If CurLine = TotalLine Then Exit;
|
||||||
|
|
||||||
If CurY = WinEnd Then
|
If CurY = WinEnd Then
|
||||||
ReFresh_Text
|
ScreenRefreshFull
|
||||||
Else Begin
|
Else Begin
|
||||||
Inc (CurY);
|
Inc (CurY);
|
||||||
Inc (CurLine);
|
Inc (CurLine);
|
||||||
|
@ -264,11 +251,8 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Up_Key (EOL: Boolean);
|
Procedure keyUpArrow (EOL: Boolean);
|
||||||
Begin
|
Begin
|
||||||
{ if curline = 1 then exit;}
|
|
||||||
{ appearently, exit is larger and slower than the statement below: }
|
|
||||||
|
|
||||||
If CurLine > 1 Then Begin
|
If CurLine > 1 Then Begin
|
||||||
If EOL then begin
|
If EOL then begin
|
||||||
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
||||||
|
@ -276,7 +260,7 @@ Begin
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If CurY = WinStart Then
|
If CurY = WinStart Then
|
||||||
Refresh_Text
|
ScreenRefreshFull
|
||||||
Else Begin
|
Else Begin
|
||||||
Dec (CurY);
|
Dec (CurY);
|
||||||
Dec (CurLine);
|
Dec (CurLine);
|
||||||
|
@ -285,18 +269,7 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Delete_Line (Num : Integer);
|
Procedure keyBackspace;
|
||||||
Var
|
|
||||||
A : Integer;
|
|
||||||
Begin
|
|
||||||
For A := Num To TotalLine - 1 Do
|
|
||||||
Session.Msgs.MsgText[A] := Session.Msgs.MsgText[A + 1];
|
|
||||||
|
|
||||||
Session.Msgs.MsgText[TotalLine] := '';
|
|
||||||
Dec (TotalLine);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Procedure Backspace;
|
|
||||||
Var
|
Var
|
||||||
A : Integer;
|
A : Integer;
|
||||||
Begin
|
Begin
|
||||||
|
@ -313,10 +286,10 @@ Begin
|
||||||
If Length(Session.Msgs.MsgText[CurLine - 1]) + Length(Session.Msgs.MsgText[CurLine]) <= WrapPos 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;
|
CurX := Length(Session.Msgs.MsgText[CurLine - 1]) + 1;
|
||||||
Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Session.Msgs.MsgText[CurLine];
|
Session.Msgs.MsgText[CurLine - 1] := Session.Msgs.MsgText[CurLine - 1] + Session.Msgs.MsgText[CurLine];
|
||||||
Delete_Line (CurLine);
|
DeleteLine (CurLine);
|
||||||
Dec (CurLine);
|
Dec (CurLine);
|
||||||
Dec (CurY);
|
Dec (CurY);
|
||||||
If CurY < WinStart Then Refresh_Text Else Refresh_Part;
|
If CurY < WinStart Then ScreenRefreshFull Else ScreenRefreshPart;
|
||||||
End Else
|
End Else
|
||||||
If Pos(' ', Session.Msgs.MsgText[CurLine]) > 0 Then Begin
|
If Pos(' ', Session.Msgs.MsgText[CurLine]) > 0 Then Begin
|
||||||
For A := Length(Session.Msgs.MsgText[CurLine]) DownTo 1 Do
|
For A := Length(Session.Msgs.MsgText[CurLine]) DownTo 1 Do
|
||||||
|
@ -326,35 +299,35 @@ Begin
|
||||||
Delete (Session.Msgs.MsgText[CurLine], 1, A);
|
Delete (Session.Msgs.MsgText[CurLine], 1, A);
|
||||||
Dec (CurLine);
|
Dec (CurLine);
|
||||||
Dec (CurY);
|
Dec (CurY);
|
||||||
If CurY < WinStart Then Refresh_Text Else Refresh_Part;
|
If CurY < WinStart Then ScreenRefreshFull Else ScreenRefreshPart;
|
||||||
Exit;
|
Exit;
|
||||||
End;
|
End;
|
||||||
Up_Key(True);
|
keyUpArrow(True);
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure left_key;
|
Procedure keyLeftArrow;
|
||||||
begin
|
begin
|
||||||
if curx > 1 then Begin
|
if curx > 1 then Begin
|
||||||
Dec (CurX);
|
Dec (CurX);
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
end else
|
end else
|
||||||
up_key(true);
|
keyUpArrow(true);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure right_key;
|
Procedure keyRightArrow;
|
||||||
Begin
|
Begin
|
||||||
if curx < length(Session.Msgs.MsgText[curline])+1 then begin
|
if curx < length(Session.Msgs.MsgText[curline])+1 then begin
|
||||||
Inc (CurX);
|
Inc (CurX);
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
end else begin
|
End Else Begin
|
||||||
if curY < totalline then curx := 1;
|
If CurY < TotalLine Then CurX := 1;
|
||||||
down_key;
|
keyDownArrow;
|
||||||
end;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Insert_Ch (Ch: Char);
|
Procedure AddChar (Ch: Char);
|
||||||
Begin
|
Begin
|
||||||
If InsertMode Then Begin
|
If InsertMode Then Begin
|
||||||
Insert (Ch, Session.Msgs.MsgText[Curline], CurX);
|
Insert (Ch, Session.Msgs.MsgText[Curline], CurX);
|
||||||
|
@ -372,8 +345,8 @@ Procedure ToggleInsert (Toggle: Boolean);
|
||||||
Begin
|
Begin
|
||||||
If Toggle Then InsertMode := Not InsertMode;
|
If Toggle Then InsertMode := Not InsertMode;
|
||||||
|
|
||||||
Session.io.AnsiColor (Session.io.ScreenInfo[3].A);
|
Session.io.AnsiColor (Session.io.ScreenInfo[3].A);
|
||||||
Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[3].Y);
|
Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[3].Y);
|
||||||
|
|
||||||
If InsertMode Then Print('INS') else Print('OVR'); { ++lang }
|
If InsertMode Then Print('INS') else Print('OVR'); { ++lang }
|
||||||
|
|
||||||
|
@ -381,7 +354,7 @@ Begin
|
||||||
Session.io.AnsiColor (tColor);
|
Session.io.AnsiColor (tColor);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Draw_Screen;
|
Procedure FullReDraw;
|
||||||
Begin
|
Begin
|
||||||
If TEdit Then Session.io.OutFile ('ansitext', True, 0) Else Session.io.OutFile ('ansiedit', True, 0);
|
If TEdit Then Session.io.OutFile ('ansitext', True, 0) Else Session.io.OutFile ('ansiedit', True, 0);
|
||||||
|
|
||||||
|
@ -391,7 +364,7 @@ Begin
|
||||||
|
|
||||||
ToggleInsert (False);
|
ToggleInsert (False);
|
||||||
|
|
||||||
Refresh_Text;
|
ScreenRefreshFull;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Quote;
|
Procedure Quote;
|
||||||
|
@ -453,7 +426,7 @@ Begin
|
||||||
If TotalLine = mysMaxMsgLines Then Break;
|
If TotalLine = mysMaxMsgLines Then Break;
|
||||||
If Session.Msgs.MsgText[CurLine] <> '' Then Begin
|
If Session.Msgs.MsgText[CurLine] <> '' Then Begin
|
||||||
Inc (CurLine);
|
Inc (CurLine);
|
||||||
Insert_Line (CurLine);
|
InsertLine (CurLine);
|
||||||
End;
|
End;
|
||||||
Session.Msgs.MsgText[CurLine] := Text[NumLines];
|
Session.Msgs.MsgText[CurLine] := Text[NumLines];
|
||||||
End;
|
End;
|
||||||
|
@ -525,7 +498,7 @@ Begin
|
||||||
Session.io.AnsiColor(tColor);
|
Session.io.AnsiColor(tColor);
|
||||||
Temp1 := WinEnd;
|
Temp1 := WinEnd;
|
||||||
WinEnd := Session.io.ScreenInfo[1].Y;
|
WinEnd := Session.io.ScreenInfo[1].Y;
|
||||||
Refresh_Text;
|
ScreenRefreshFull;
|
||||||
WinEnd := Temp1;
|
WinEnd := Temp1;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
@ -607,7 +580,7 @@ Begin
|
||||||
|
|
||||||
If QuoteTopPage + QuoteCurLine = QuoteLines Then NoMore := True;
|
If QuoteTopPage + QuoteCurLine = QuoteLines Then NoMore := True;
|
||||||
|
|
||||||
Insert_Line (CurLine);
|
InsertLine (CurLine);
|
||||||
Session.Msgs.MsgText[CurLine] := QText[QuoteTopPage + QuoteCurLine];
|
Session.Msgs.MsgText[CurLine] := QText[QuoteTopPage + QuoteCurLine];
|
||||||
Inc (CurLine);
|
Inc (CurLine);
|
||||||
|
|
||||||
|
@ -616,11 +589,11 @@ Begin
|
||||||
Temp1 := WinEnd;
|
Temp1 := WinEnd;
|
||||||
WinEnd := Session.io.ScreenInfo[1].Y;
|
WinEnd := Session.io.ScreenInfo[1].Y;
|
||||||
If CurLine - Scroll + WinStart + 4 >= WinEnd Then Begin
|
If CurLine - Scroll + WinStart + 4 >= WinEnd Then Begin
|
||||||
Refresh_Text;
|
ScreenRefreshFull;
|
||||||
Scroll := CurLine;
|
Scroll := CurLine;
|
||||||
End Else Begin
|
End Else Begin
|
||||||
Dec (CurLine);
|
Dec (CurLine);
|
||||||
Refresh_Part;
|
ScreenRefreshPart;
|
||||||
Inc (CurLine);
|
Inc (CurLine);
|
||||||
Inc (CurY);
|
Inc (CurY);
|
||||||
End;
|
End;
|
||||||
|
@ -695,69 +668,78 @@ Begin
|
||||||
Until Done;
|
Until Done;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Page_Up;
|
Procedure keyPageUp;
|
||||||
Begin
|
Begin
|
||||||
If CurLine > 1 Then Begin
|
If CurLine > 1 Then Begin
|
||||||
If LongInt(CurLine - (WinEnd - WinStart)) >= 1 Then
|
If LongInt(CurLine - (WinEnd - WinStart)) >= 1 Then
|
||||||
Dec (CurLine, (WinEnd - WinStart)) {scroll one page up}
|
Dec (CurLine, (WinEnd - WinStart)) {scroll one page up}
|
||||||
Else
|
Else
|
||||||
CurLine := 1;
|
CurLine := 1;
|
||||||
Refresh_Text;
|
ScreenRefreshFull;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure Page_Down;
|
Procedure keyPageDown;
|
||||||
Begin
|
Begin
|
||||||
If CurLine < TotalLine Then Begin
|
If CurLine < TotalLine Then Begin
|
||||||
|
|
||||||
If CurLine + (WinEnd - WinStart) <= TotalLine Then
|
If CurLine + (WinEnd - WinStart) <= TotalLine Then
|
||||||
Inc (CurLine, (WinEnd - WinStart))
|
Inc (CurLine, (WinEnd - WinStart))
|
||||||
Else
|
Else
|
||||||
CurLine := TotalLine;
|
CurLine := TotalLine;
|
||||||
Refresh_Text;
|
|
||||||
|
ScreenRefreshFull;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Procedure keyEnd;
|
||||||
|
Begin
|
||||||
|
CurX := Length(Session.Msgs.MsgText[CurLine]) + 1;
|
||||||
|
|
||||||
|
If CurX > WrapPos Then CurX := WrapPos + 1;
|
||||||
|
|
||||||
|
UpdatePosition;
|
||||||
|
End;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
A : Integer;
|
A : Integer;
|
||||||
Begin
|
Begin
|
||||||
QuoteCurLine := 0;
|
QuoteCurLine := 0;
|
||||||
QuoteTopPage := 1;
|
QuoteTopPage := 1;
|
||||||
|
CurLine := Lines;
|
||||||
|
|
||||||
CurLine := Lines;
|
|
||||||
If Lines = 0 Then CurLine := 1;
|
If Lines = 0 Then CurLine := 1;
|
||||||
Done := False;
|
|
||||||
CurX := 1;
|
Done := False;
|
||||||
CurY := WinStart;
|
CurX := 1;
|
||||||
|
CurY := WinStart;
|
||||||
TotalLine := CurLine;
|
TotalLine := CurLine;
|
||||||
|
|
||||||
Dec (WrapPos); { Kludge to make sure text length = WrapPos length }
|
Dec (WrapPos);
|
||||||
|
|
||||||
For A := Lines + 1 to mysMaxMsgLines Do Session.Msgs.MsgText[A] := '';
|
FillChar(Session.Msgs.MsgText, SizeOf(Session.Msgs.MsgText), #0);
|
||||||
|
|
||||||
Draw_Screen;
|
FullReDraw;
|
||||||
|
|
||||||
Session.io.AllowArrow := True;
|
Session.io.AllowArrow := True;
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Ch := Session.io.GetKey;
|
Ch := Session.io.GetKey;
|
||||||
|
|
||||||
If Session.io.IsArrow Then Begin
|
If Session.io.IsArrow Then Begin
|
||||||
Case Ch of
|
Case Ch of
|
||||||
#71 : Begin
|
#71 : Begin
|
||||||
CurX := 1;
|
CurX := 1;
|
||||||
UpdatePosition;
|
UpdatePosition;
|
||||||
End;
|
End;
|
||||||
#72 : Up_Key(False);
|
#72 : keyUpArrow(False);
|
||||||
#73 : Page_Up;
|
#73 : keyPageUp;
|
||||||
#75 : Left_Key;
|
#75 : keyLeftArrow;
|
||||||
#77 : Right_Key;
|
#77 : keyRightArrow;
|
||||||
#79 : Begin
|
#79 : keyEnd;
|
||||||
CurX := Length(Session.Msgs.MsgText[CurLine]) + 1;
|
#80 : keyDownArrow;
|
||||||
If CurX > WrapPos Then CurX := WrapPos + 1; {since we DEC(WrapPos) on start}
|
#81 : keyPageDown;
|
||||||
UpdatePosition;
|
#82 : ToggleInsert(True);
|
||||||
End;
|
|
||||||
#80 : Down_Key;
|
|
||||||
#81 : Page_Down;
|
|
||||||
#82 : ToggleInsert (True);
|
|
||||||
#83 : If CurX <= Length(Session.Msgs.MsgText[CurLine]) Then Begin
|
#83 : If CurX <= Length(Session.Msgs.MsgText[CurLine]) Then Begin
|
||||||
Delete (Session.Msgs.MsgText[CurLine], CurX, 1);
|
Delete (Session.Msgs.MsgText[CurLine], CurX, 1);
|
||||||
Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])) + ' ');
|
Print (Copy(Session.Msgs.MsgText[CurLine], CurX, Length(Session.Msgs.MsgText[CurLine])) + ' ');
|
||||||
|
@ -765,20 +747,20 @@ Begin
|
||||||
End Else
|
End Else
|
||||||
If CurLine < TotalLine Then
|
If CurLine < TotalLine Then
|
||||||
If (Session.Msgs.MsgText[CurLine] = '') and (TotalLine > 1) Then Begin
|
If (Session.Msgs.MsgText[CurLine] = '') and (TotalLine > 1) Then Begin
|
||||||
Delete_Line (CurLine);
|
DeleteLine (CurLine);
|
||||||
Refresh_Part;
|
ScreenRefreshPart;
|
||||||
End Else
|
End Else
|
||||||
If TotalLine > 1 Then
|
If TotalLine > 1 Then
|
||||||
If Length(Session.Msgs.MsgText[CurLine]) + Length(Session.Msgs.MsgText[CurLine + 1]) <= WrapPos Then Begin
|
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];
|
Session.Msgs.MsgText[CurLine] := Session.Msgs.MsgText[CurLine] + Session.Msgs.MsgText[CurLine + 1];
|
||||||
Delete_Line (CurLine + 1);
|
DeleteLine (CurLine + 1);
|
||||||
Refresh_Part;
|
ScreenRefreshPart;
|
||||||
End Else
|
End Else
|
||||||
For A := Length(Session.Msgs.MsgText[CurLine + 1]) DownTo 1 Do
|
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
|
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);
|
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);
|
Delete (Session.Msgs.MsgText[CurLine + 1], 1, A);
|
||||||
Refresh_Part;
|
ScreenRefreshPart;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
End Else
|
End Else
|
||||||
|
@ -787,44 +769,104 @@ Begin
|
||||||
Done := True;
|
Done := True;
|
||||||
Save := False;
|
Save := False;
|
||||||
End;
|
End;
|
||||||
{B} #2 : Draw_Screen;
|
^B : FullReDraw;
|
||||||
#8 : Backspace;
|
^D : keyRightArrow;
|
||||||
{I} #9,
|
^E : keyUpArrow(False);
|
||||||
#13 : Begin
|
^F : Begin
|
||||||
Session.io.PurgeInputBuffer;
|
CurX := 1;
|
||||||
Do_Enter;
|
UpdatePosition;
|
||||||
End;
|
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;
|
||||||
|
^K : ; // cuttext
|
||||||
|
^L,
|
||||||
|
^M : Begin
|
||||||
|
Session.io.PurgeInputBuffer;
|
||||||
|
keyEnter;
|
||||||
|
End;
|
||||||
|
^N : keyPageDown;
|
||||||
|
^O : Begin
|
||||||
|
Session.io.OutFile('fshelp', True, 0);
|
||||||
|
FullReDraw;
|
||||||
|
End;
|
||||||
|
^P : keyPageUp;
|
||||||
^Q : Begin
|
^Q : Begin
|
||||||
If Session.User.ThisUser.UseLBQuote Then
|
If Session.User.ThisUser.UseLBQuote Then
|
||||||
QuoteWindow
|
QuoteWindow
|
||||||
Else
|
Else
|
||||||
Quote;
|
Quote;
|
||||||
Draw_Screen;
|
|
||||||
|
FullReDraw;
|
||||||
|
End;
|
||||||
|
^R : ; // paste
|
||||||
|
^T : If CurX > 1 Then Begin
|
||||||
|
While (CurX > 1) and (Session.Msgs.MsgText[CurLine][CurX] <> ' ') Do Dec(CurX);
|
||||||
|
While (CurX > 1) and (Session.Msgs.MsgText[CurLine][CurX] = ' ') Do Dec(CurX);
|
||||||
|
While (CurX > 1) and (Session.Msgs.MsgText[CurLine][CurX] <> ' ') Do Dec(CurX);
|
||||||
|
|
||||||
|
If CurX > 1 Then Inc (CurX);
|
||||||
|
|
||||||
|
UpdatePosition;
|
||||||
|
End;
|
||||||
|
^U : 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;
|
End;
|
||||||
^V : ToggleInsert (True);
|
^V : ToggleInsert (True);
|
||||||
{Y} #25 : begin
|
^W : ; // delete word left
|
||||||
delete_line (curline);
|
^X : keyDownArrow;
|
||||||
refresh_part;
|
^Y : Begin
|
||||||
end;
|
DeleteLine (curline);
|
||||||
#27 : Begin
|
ScreenRefreshPart;
|
||||||
|
End;
|
||||||
|
^[ : Begin
|
||||||
Commands;
|
Commands;
|
||||||
If (Not Save) and (Not Done) Then Draw_Screen;
|
|
||||||
Session.io.AllowArrow := True; { just in case... }
|
If (Not Save) and (Not Done) Then FullReDraw;
|
||||||
|
|
||||||
|
Session.io.AllowArrow := True;
|
||||||
End;
|
End;
|
||||||
#32..
|
#32..
|
||||||
#254: Begin
|
#254: Begin
|
||||||
If Length(Session.Msgs.MsgText[CurLine]) >= WrapPos Then begin
|
If Length(Session.Msgs.MsgText[CurLine]) >= WrapPos Then begin
|
||||||
If TotalLine < MaxLines Then Begin
|
If TotalLine < MaxLines Then Begin
|
||||||
insert_ch (ch);
|
AddChar (Ch);
|
||||||
format_text;
|
TextReformat;
|
||||||
End;
|
End;
|
||||||
End Else
|
End Else
|
||||||
If (CurX = 1) and (Ch = '/') Then begin
|
If (CurX = 1) and (Ch = '/') Then Begin
|
||||||
Commands;
|
Commands;
|
||||||
If (Not Save) and (Not Done) Then Draw_Screen;
|
If (Not Save) and (Not Done) Then FullReDraw;
|
||||||
Session.io.AllowArrow := True; { just in case ... }
|
Session.io.AllowArrow := True;
|
||||||
End Else
|
End Else
|
||||||
insert_ch (ch);
|
AddChar (Ch);
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
Until Done;
|
Until Done;
|
||||||
|
@ -840,9 +882,9 @@ Begin
|
||||||
Lines := TotalLine;
|
Lines := TotalLine;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
AnsiEditor := (Save = True);
|
Result := (Save = True);
|
||||||
|
|
||||||
Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize);
|
Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize);
|
||||||
{ Session.io.AnsiGotoXY (1, WinEnd + 1);}
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
End.
|
End.
|
||||||
|
|
Loading…
Reference in New Issue