Restructure of some control commands. Cut and Uncut ability same as Nano/Pico
This commit is contained in:
parent
74848b1dbb
commit
33e8e80fed
|
@ -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
|
||||||
WinStart : Byte = 2;
|
MaxCutText = 100;
|
||||||
WinEnd : Byte = 22;
|
Type
|
||||||
WinText : Byte = 7;
|
CutTextPtr = ^CutTextRec;
|
||||||
InsertMode : Boolean = True;
|
CutTextRec = String[79];
|
||||||
|
|
||||||
Var
|
Var
|
||||||
|
WinStart : Byte = 2;
|
||||||
|
WinEnd : Byte = 22;
|
||||||
|
WinText : Byte = 7;
|
||||||
|
InsertMode : Boolean = True;
|
||||||
|
CutPasted : Boolean = False;
|
||||||
|
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.
|
Loading…
Reference in New Issue