Restructure of some control commands. Cut and Uncut ability same as Nano/Pico

This commit is contained in:
mysticbbs 2012-02-27 17:11:31 -05:00
parent 74848b1dbb
commit 33e8e80fed
1 changed files with 57 additions and 18 deletions

View File

@ -29,12 +29,18 @@ End;
Function AnsiEditor (Var Lines: Integer; WrapPos: Byte; MaxLines: Integer; TEdit, Forced: Boolean; Var Subj: String) : Boolean; Function AnsiEditor (Var Lines: Integer; WrapPos: Byte; MaxLines: Integer; TEdit, Forced: Boolean; Var Subj: String) : Boolean;
Const Const
MaxCutText = 100;
Type
CutTextPtr = ^CutTextRec;
CutTextRec = String[79];
Var
WinStart : Byte = 2; WinStart : Byte = 2;
WinEnd : Byte = 22; WinEnd : Byte = 22;
WinText : Byte = 7; WinText : Byte = 7;
InsertMode : Boolean = True; InsertMode : Boolean = True;
CutPasted : Boolean = False;
Var CutTextPos : Word = 0;
CutText : Array[1..MaxCutText] of CutTextPtr;
Done : Boolean; Done : Boolean;
Save : Boolean; Save : Boolean;
Ch : Char; Ch : Char;
@ -849,7 +855,27 @@ Begin
Session.io.AnsiClrEOL; Session.io.AnsiClrEOL;
End; End;
^K : ; // cuttext... what will be copy? ^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;
^L, ^L,
^M : Begin ^M : Begin
Session.io.PurgeInputBuffer; Session.io.PurgeInputBuffer;
@ -869,17 +895,7 @@ Begin
FullReDraw; FullReDraw;
End; End;
^R : ; // paste ^R : Begin
^T : Begin
While CurX > 1 Do Begin
Dec (CurX);
If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break;
End;
UpdatePosition;
End;
^U : Begin
While CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Do Begin While CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Do Begin
Inc (CurX); Inc (CurX);
@ -891,6 +907,26 @@ Begin
UpdatePosition; UpdatePosition;
End; End;
^T : Begin
While CurX > 1 Do Begin
Dec (CurX);
If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break;
End;
UpdatePosition;
End;
^U : If CutTextPos > 0 Then Begin
CutPasted := True;
For A := CutTextPos DownTo 1 Do
If TotalLine < mysMaxMsgLines Then Begin
InsertLine(CurLine);
Session.Msgs.MsgText[CurLine] := CutText[A]^;
End;
TextRefreshPart;
End;
^V : ToggleInsert (True); ^V : ToggleInsert (True);
^W : While (CurX > 1) Do Begin ^W : While (CurX > 1) Do Begin
keyBackSpace; keyBackSpace;
@ -944,6 +980,9 @@ Begin
Result := (Save = True); Result := (Save = True);
Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize); Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize);
For A := CutTextPos DownTo 1 Do
Dispose (CutText[A]);
End; End;
End. End.