From 33e8e80fed75b94a8bf4378120c31d1e4eb6d203 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Mon, 27 Feb 2012 17:11:31 -0500 Subject: [PATCH] Restructure of some control commands. Cut and Uncut ability same as Nano/Pico --- mystic/bbs_edit_full.pas | 75 ++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/mystic/bbs_edit_full.pas b/mystic/bbs_edit_full.pas index a1a63d5..865a360 100644 --- a/mystic/bbs_edit_full.pas +++ b/mystic/bbs_edit_full.pas @@ -29,12 +29,18 @@ End; Function AnsiEditor (Var Lines: Integer; WrapPos: Byte; MaxLines: Integer; TEdit, Forced: Boolean; Var Subj: String) : Boolean; Const - WinStart : Byte = 2; - WinEnd : Byte = 22; - WinText : Byte = 7; - InsertMode : Boolean = True; - + MaxCutText = 100; +Type + CutTextPtr = ^CutTextRec; + CutTextRec = String[79]; 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; Save : Boolean; Ch : Char; @@ -849,7 +855,27 @@ Begin Session.io.AnsiClrEOL; 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, ^M : Begin Session.io.PurgeInputBuffer; @@ -869,17 +895,7 @@ Begin FullReDraw; End; - ^R : ; // paste - ^T : Begin - While CurX > 1 Do Begin - Dec (CurX); - - If Session.Msgs.MsgText[CurLine][CurX] = ' ' Then Break; - End; - - UpdatePosition; - End; - ^U : Begin + ^R : Begin While CurX < Length(Session.Msgs.MsgText[CurLine]) + 1 Do Begin Inc (CurX); @@ -891,6 +907,26 @@ Begin UpdatePosition; 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); ^W : While (CurX > 1) Do Begin keyBackSpace; @@ -944,6 +980,9 @@ Begin Result := (Save = True); Session.io.AnsiGotoXY (1, Session.User.ThisUser.ScreenSize); + + For A := CutTextPos DownTo 1 Do + Dispose (CutText[A]); End; -End. +End. \ No newline at end of file