home *** CD-ROM | disk | FTP | other *** search
- Unit STI_ED_F;
-
- interface
-
- Uses Crt, { standard TP 5.0 library }
- Dos, { staandard Dos unit }
- STI_SCRF, { a few screen procedures }
- STI_STRN, { string handling }
- STI_KEYS, { key scanning unit }
- STI_ED_V, { editor variables }
- Printer; { printer unit }
-
- procedure Erase_Buffer;
- procedure Reset_Colors; { reset display colors }
- procedure Error_Message(Message : string); { put a message on screen }
- function Allocate_One_Line(LineNo : word) : boolean;
- procedure Set_Up_Screen(Var Buff : Buffer); { open the window }
- procedure Restore_Screen(Var Buff : Buffer);{ reset the window }
- procedure Put_Top_Line; { draw the top line }
- procedure Put_Bottom_Line; { put the bottom line }
- procedure Load_File(Name : string); { load in a file }
- procedure Draw_All_Screen;
- procedure One_Screen_Down; { scroll down one page }
- procedure One_Screen_Up; { scroll up one page }
- procedure Jump_End_Of_File;
- procedure Jump_Start_Of_File;
- procedure One_Line_Up;
- procedure One_Line_Down;
- procedure One_Char_Left;
- procedure One_Char_Right;
- procedure Begin_Of_Line;
- procedure End_Of_Line;
- procedure Erase_Line_Contents(LineNo : word);
- procedure Insert_One_Line;
- procedure Delete_One_Line;
- procedure Process_Return_Key;
- procedure Delete_One_Char;
- procedure Do_Tab;
- procedure Reset_TAB;
- procedure Do_Help;
- procedure Save_File(Name : string);
- procedure Load_New_File;
- procedure Search;
- procedure Search_And_Replace;
- procedure Quit_Check;
- procedure One_Word_Back;
- procedure One_Word_Forward;
- procedure Block_Mark_Start;
- procedure Block_Mark_End;
- procedure Block_Copy;
- procedure Block_Erase;
- procedure Block_Read;
- procedure Block_Write;
- procedure Block_Move;
- procedure Erase_One_Word;
- procedure Pass_Chars_On(Pass : ChrSet);
- procedure Block_Print;
- procedure Print_File;
-
-
- implementation
-
- {---------------------------------------------------------------------------}
-
- procedure Reset_Block_Markers;
-
- begin
- Edit_Buffer^.Block.BC := 0;
- Edit_Buffer^.Block.BL := 0;
- Edit_Buffer^.Block.EC := 0;
- Edit_Buffer^.Block.EL := 0;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Erase_Buffer;
-
- Var
- Loop : Word;
-
- begin
- for Loop := 1 to MAX_LINES do
- begin
- if Edit_Buffer^.TextBuffer^[Loop] <> NIL then
- begin
- Dispose(Edit_Buffer^.TextBuffer^[Loop]);
- Edit_Buffer^.TextBuffer^[Loop] := NIL;
- end;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Reset_Colors; { reset display colors }
-
- begin
- TextColor(White); { default is white }
- TextReverse(NoReverse); { default is no reverse }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Error_Message(Message : string); { put a message on screen }
-
- Var
- Len : byte;
-
- begin
- Len := length(Message);
- TextColor(Edit_Buffer^.PromptCol); { change to prompt color }
- GotoXY(Edit_Buffer^.X1, { move to the bottom line }
- Edit_Buffer^.Y2+1);
- Message := Message + makeStr(80,32); { pack the string }
- Write(copy(message,1,Edit_Buffer^.X2-Edit_Buffer^.X1+1)); { write message }
- GotoXY(Edit_Buffer^.X1+Len,Edit_Buffer^.Y2+1);
- end;
-
- {---------------------------------------------------------------------------}
-
- function Allocate_One_Line(LineNo : word) : boolean;
-
- begin
- if Edit_Buffer^.TextBuffer^[LineNo] = NIL then
- begin
- if MemAvail > 4000 then
- begin
- New(Edit_Buffer^.TextBuffer^[LineNo]);
- Allocate_One_Line := TRUE;
- Edit_Buffer^.TextBuffer^[LineNo]^ := #31;
- end
- else
- begin
- Error_Message('Out of memory');
- Allocate_One_Line := FALSE;
- end;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Set_Up_Screen(Var Buff : Buffer); { open the window }
- { and save the old screen }
- begin
- MakeWindow(Buff.WinSave,Buff.X1,Buff.Y1, { open a window }
- Buff.X2,Buff.Y2,Buff.TextCol, { & save screen etc }
- Buff.BorderCol,Buff.Border);
- if Buff.Border then { check for a border }
- begin
- Inc(Buff.X1); Inc(Buff.Y1); { adjust the window boundaries }
- Dec(Buff.X2); Dec(Buff.Y2); { adjust the window boundaries }
- end
- else
- Inc(Buff.Y1); { always leave bottom free }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Restore_Screen(Var Buff : Buffer);{ reset the window }
-
- begin
- DisposeWindow(Buff.WinSave); { draw the old screen }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Put_Top_Line; { draw the top line }
-
- Var
- Dummy1, { dummy strings }
- Dummy2 : string;
-
- begin
- TextColor(Edit_Buffer^.BorderCol); { set the color to frame }
- GotoXY(Edit_Buffer^.X1,Edit_Buffer^.Y1-1);{ goto a good place }
- Str(Edit_Buffer^.Row:6,Dummy1); { get the string converted }
- Dummy2 := ' Line : '+Dummy1+' Col : '; { start building it up }
- Str(Edit_Buffer^.Column:3,Dummy1); { get the string converted }
- Dummy2 := Dummy2 + Dummy1; { build, build }
- if Edit_Buffer^.Insert then { check for insert mode }
- Dummy2 := Dummy2 + ' INSERT ' { insert is on }
- else
- Dummy2 := Dummy2 + ' '; { insert is off }
- Dummy2 := Dummy2 + Edit_Buffer^.FileName; { add the file name }
- Str(MemAvail:6,Dummy1); { get the string converted }
- Dummy2 := Dummy2 + ' Mem : ' + Dummy1; { last thing of all }
- Dummy2 := Dummy2 + MakeStr(128,32); { build it right up }
- Write(copy(Dummy2,1,(Edit_Buffer^.X2-Edit_Buffer^.X1)+1));
- Reset_Colors; { back to defaults }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Put_Bottom_Line; { put the bottom line }
-
- Var
- Dummy : string; { dummy string }
-
- begin
- TextColor(Edit_Buffer^.BorderCol); { set the color to frame }
- GotoXY(Edit_Buffer^.X1,Edit_Buffer^.Y2+1);{ goto a good place }
- if STI_CapsPressed then { check for caps }
- Dummy := ' CAPS ' { yes, add it to dummy }
- else
- Dummy := ' '; { no, add spaces }
- if STI_KanaPressed then { check for kana key }
- Dummy := Dummy + ' KANA ' { yes, add it to dummy }
- else
- Dummy := Dummy + ' '; { no, add spaces }
- Dummy := Dummy + MakeStr(128,32); { pack the string }
- Write(copy(Dummy,1,(Edit_Buffer^.X2-Edit_Buffer^.X1)+1));
- Reset_Colors; { back to defaults }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Load_File(Name : string); { load in a file }
-
- Var
- InFile : Text; { the file }
- Dummy : string; { dummy string }
- Loop : byte;
-
- begin
- Name := UpCaseStr(Name);
- Edit_Buffer^.FileName := Name;
- Edit_Buffer^.NoLines := 1; { reset the number of lines }
- assign(InFile,Name); { set the file name }
- {$I-}
- reset(InFile); { open it }
- {$I+}
- if IOResult <> 0 then { no can do }
- begin
- Error_Message('New File : '+Name); { put a little message }
- Reset_Colors;
- Exit; { then get oput of here }
- end;
- Error_Message('Loading '+UpCaseStr(Name)+'...'); { put a prompt }
- HiddenCursor; { hide the cursor }
- while not(eof(InFile)) do { loop until end of file }
- begin
- ReadLn(InFile,Dummy); { read in a line }
- for Loop := 1 to length(Dummy) do
- begin
- if Dummy[Loop] = #9 then
- Dummy := copy(Dummy,1,Loop-1)+MakeStr(Loop mod 8,32)+Copy(Dummy,Loop+1,255);
- end;
- Dummy := Dummy + #31;
- if Edit_Buffer^.TextBuffer^[Edit_Buffer^.NoLines] <> NIL then
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.NoLines]^ := Dummy
- else
- begin
- if Length(Dummy)+2000 > MemAvail then
- Error_Message('Not enough memory to read complete file')
- else
- begin
- New(Edit_Buffer^.TextBuffer^[Edit_Buffer^.NoLines]);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.NoLines]^ := Dummy
- end;
- end;
- Put_Top_Line; { write top line }
- Inc(Edit_Buffer^.NoLines); { increment number of lines }
- end;
- Close(InFile); { close the file }
- Put_Bottom_Line; { draw the bottom line }
- NormalCursor; { restore cursor }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Draw_All_Screen;
-
- Var
- Loop : byte;
- LineNo : word;
- FromC : byte;
-
- begin
- HiddenCursor;
- FromC := (Edit_Buffer^.Column - Edit_Buffer^.SCRX) + 1;
- Window(Edit_Buffer^.X1,Edit_Buffer^.Y1,Edit_Buffer^.X2,Edit_Buffer^.Y2);
- TextColor(Edit_Buffer^.TextCol);
- for Loop := 1 to Edit_Buffer^.Y2-Edit_Buffer^.Y1+1 do
- begin
- LineNo := (Edit_Buffer^.Row - Edit_Buffer^.SCRY) + Loop;
- GotoXY(1,Loop);
- ClrEol;
- if (Edit_Buffer^.Block.BL < LineNo) and (LineNo < Edit_Buffer^.Block.EL) then
- begin
- Reset_Colors;
- TextColor(Edit_Buffer^.PromptCol);
- end;
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Write(copy(Edit_Buffer^.TextBuffer^[LineNo]^,FromC,
- Edit_Buffer^.X2 - Edit_Buffer^.X1));
- if (Edit_Buffer^.Block.BL = LineNo) then
- begin
- Reset_Colors;
- TextColor(Edit_Buffer^.PromptCol);
- if (Edit_Buffer^.Block.BC <= FromC) then
- begin
- GotoXY(1,Loop);
- ClrEol;
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Write(copy(Edit_Buffer^.TextBuffer^[LineNo]^,FromC,
- Edit_Buffer^.X2 - Edit_Buffer^.X1));
- end
- else
- begin
- GotoXY((Edit_Buffer^.Block.BC - FromC)+1,Loop);
- ClrEol;
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Write(copy(Edit_Buffer^.TextBuffer^[LineNo]^,Edit_Buffer^.Block.BC,
- (Edit_Buffer^.X2 - Edit_Buffer^.X1)-Edit_Buffer^.Block.BC));
- end;
- end;
- if (Edit_Buffer^.Block.EL = LineNo) then
- begin
- Reset_Colors;
- TextColor(Edit_Buffer^.TextCol);
- if FromC > Edit_Buffer^.Block.EC then
- begin
- GotoXY(1,Loop);
- ClrEol;
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Write(copy(Edit_Buffer^.TextBuffer^[LineNo]^,FromC,
- Edit_Buffer^.X2 - Edit_Buffer^.X1));
- end
- else
- begin
- GotoXY((Edit_Buffer^.Block.EC - FromC)+1,Loop);
- ClrEol;
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Write(copy(Edit_Buffer^.TextBuffer^[LineNo]^,Edit_Buffer^.Block.EC,
- Edit_Buffer^.X2 - Edit_Buffer^.X1));
- end;
- end;
- end;
- Reset_Colors;
- Window(1,1,80,25);
- Put_Top_Line;
- Put_Bottom_Line;
- NormalCursor;
- GotoXY(Edit_Buffer^.X1+Edit_Buffer^.SCRX -1,
- Edit_Buffer^.Y1+Edit_Buffer^.SCRY -1);
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Screen_Down; { scroll down one page }
-
- begin
- Edit_Buffer^.SCRY := 1;
- if Edit_Buffer^.Row > (Edit_Buffer^.Y2 - Edit_Buffer^.Y1) then
- Edit_Buffer^.Row := Edit_Buffer^.Row - ((Edit_Buffer^.Y2-Edit_Buffer^.Y1) -2)
- else
- Edit_Buffer^.Row := 1;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Screen_Up; { scroll up one page }
-
- begin
- if Edit_Buffer^.Row < Edit_Buffer^.NoLines - (Edit_Buffer^.Y2 - Edit_Buffer^.Y1) then
- Edit_Buffer^.Row := Edit_Buffer^.Row +
- ((Edit_Buffer^.Y2-Edit_Buffer^.Y1) -2)
- else
- begin
- Edit_Buffer^.SCRY := 1;
- Edit_Buffer^.Row := Edit_Buffer^.NoLInes;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Jump_End_Of_File;
-
- begin
- Edit_Buffer^.SCRY := 1;
- Edit_Buffer^.Row := Edit_Buffer^.NoLInes;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Jump_Start_Of_File;
-
- begin
- Edit_Buffer^.SCRY := 1;
- Edit_Buffer^.Row := 1;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Line_Up;
-
- begin
- if Edit_Buffer^.Row > 1 then
- begin
- Dec(Edit_Buffer^.Row);
- Dec(Edit_Buffer^.SCRY);
- if Edit_Buffer^.SCRY = 0 then
- begin
- Edit_Buffer^.SCRY := 1;
- Draw_All_Screen;
- Exit;
- end;
- Put_Top_Line;
- Put_Bottom_Line;
- Delay(70);
- GotoXY(Edit_Buffer^.SCRX+Edit_Buffer^.X1-1,
- Edit_Buffer^.SCRY+Edit_Buffer^.Y1-1);
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Line_Down;
-
- begin
- if Edit_Buffer^.Row < Edit_Buffer^.NoLines then
- begin
- Inc(Edit_Buffer^.Row);
- Inc(Edit_Buffer^.SCRY);
- if Edit_Buffer^.SCRY > (Edit_Buffer^.Y2 - Edit_Buffer^.Y1)+1 then
- begin
- Dec(Edit_Buffer^.SCRY);
- Draw_All_Screen;
- Exit;
- end;
- Put_Top_Line;
- Put_Bottom_Line;
- Delay(70);
- GotoXY(Edit_Buffer^.SCRX+Edit_Buffer^.X1-1,
- Edit_Buffer^.SCRY+Edit_Buffer^.Y1-1);
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Char_Left;
-
- begin
- Dec(Edit_Buffer^.Column);
- Dec(Edit_Buffer^.SCRX);
- if (Edit_Buffer^.SCRX = 0) and (Edit_Buffer^.Column = 0) then
- begin
- if Edit_Buffer^.Row = 1 then
- begin
- Edit_Buffer^.SCRX := 1;
- Edit_Buffer^.Column := 1;
- Put_top_Line;
- end
- else
- begin
- One_Line_Up;
- Edit_Buffer^.Column := length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- if Edit_Buffer^.Column > Edit_Buffer^.X2 - Edit_Buffer^.X1 then
- Edit_Buffer^.SCRX := Edit_Buffer^.X2 - Edit_Buffer^.X1
- else
- Edit_Buffer^.SCRX := Edit_Buffer^.Column;
- end;
- end
- else
- if (Edit_Buffer^.Column > 0) and (Edit_Buffer^.SCRX = 0) then
- begin
- Edit_Buffer^.SCRX := 1;
- Draw_All_Screen;
- Exit;
- end;
- Put_Bottom_Line;
- Put_Top_Line;
- Delay(70);
- GotoXY(Edit_Buffer^.X1+Edit_Buffer^.SCRX -1,
- Edit_Buffer^.Y1+Edit_Buffer^.SCRY -1);
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Char_Right;
-
- begin
- Inc(Edit_Buffer^.Column);
- Inc(Edit_Buffer^.SCRX);
- if (Edit_Buffer^.SCRX > (Edit_Buffer^.X2-Edit_Buffer^.X1)) then
- begin
- if Edit_Buffer^.Column <= length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^) then
- begin
- Dec(Edit_Buffer^.SCRX);
- Draw_All_Screen;
- Exit;
- end
- else
- begin
- Edit_Buffer^.SCRX := 1;
- One_Line_Down;
- Exit;
- end;
- end
- else
- if Edit_Buffer^.Column > length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^) then
- begin
- One_Line_Down;
- Edit_Buffer^.Column := 1;
- Edit_Buffer^.SCRX := 1;
- end;
- Put_Top_Line;
- Put_Bottom_Line;
- Delay(70);
- GotoXY(Edit_Buffer^.X1+Edit_Buffer^.SCRX -1,
- Edit_Buffer^.Y1+Edit_Buffer^.SCRY -1);
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Begin_Of_Line;
-
- begin
- Edit_Buffer^.SCRX := 1;
- Edit_Buffer^.Column := 1;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure End_Of_Line;
-
- begin
- Edit_Buffer^.Column := length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- if Edit_Buffer^.Column > Edit_Buffer^.X2 - Edit_Buffer^.X1 then
- Edit_Buffer^.SCRX := Edit_Buffer^.X2 - Edit_Buffer^.X1
- else
- Edit_Buffer^.SCRX := Edit_Buffer^.Column;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Erase_Line_Contents(LineNo : word);
-
- begin
- if Edit_Buffer^.TextBuffer^[LineNo] <> NIL then
- Edit_Buffer^.TextBuffer^[LineNo]^ := #31;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Insert_One_Line;
-
- Var
- Loop : word;
-
- begin
- Inc(Edit_Buffer^.NoLines);
- for Loop := Edit_Buffer^.NoLines downto Edit_Buffer^.Row + 1 do
- begin
- Edit_Buffer^.TextBuffer^[Loop] := Edit_Buffer^.TextBuffer^[Loop-1];
- end;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row] := NIL;
- if not Allocate_One_Line(Edit_Buffer^.Row) then
- begin
- Error_Message('Out_Of_Memory');
- end;
- Begin_Of_Line;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Delete_One_Line;
-
-
- Var
- Loop : word;
-
- begin
- if Edit_Buffer^.Row > Edit_Buffer^.NoLines then
- Exit;
- Dispose(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]);
- for Loop := Edit_Buffer^.Row to Edit_Buffer^.NoLInes - 1 do
- begin
- Edit_Buffer^.TextBuffer^[Loop] := Edit_Buffer^.TextBuffer^[Loop+1];
- end;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.NoLines] := NIL;
- Dec(Edit_Buffer^.NoLines);
- Begin_Of_Line;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Process_Return_Key;
-
- Var
- Dummy : string;
- Col,Len : byte;
-
- begin
- Col := Edit_Buffer^.Column;
- Len := length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- if Col > Len then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ :=
- Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,1,Len-1)
- + MakeStr(Col-Len,32) + #31;
- end;
- if Edit_Buffer^.Insert then
- begin
- if (Edit_Buffer^.Column = 1) then
- begin
- Insert_One_Line;
- One_Line_Down;
- end
- else
- if (Edit_Buffer^.Column = length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^)) then
- begin
- One_Line_Down;
- Insert_One_Line;
- end
- else
- begin
- Dummy := copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,Edit_Buffer^.Column,128);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ :=
- copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,1,Edit_Buffer^.Column-1)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Dummy+#31;
- end;
- end
- else
- begin
- Edit_Buffer^.Column := 1;
- Edit_Buffer^.SCRX := 1;
- One_Line_Down;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Delete_One_Char;
-
- Var
- Col,Len : byte;
- Dummy : string;
-
- begin
- Col := Edit_Buffer^.Column;
- Len := Length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- Dummy := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^;
- if Col > Len then
- Exit;
- if Col < Len then
- begin
- Dummy := Copy(Dummy,1,Col-1) + Copy(Dummy,Col+1,128);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Dummy;
- end
- else
- begin
- if Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row+1] <> NIL then
- begin
- Dummy := Copy(Dummy,1,Len-1) + Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row+1]^;
- if Length(Dummy) < 128 then
- begin
- Col := Edit_Buffer^.Column;
- Delete_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Dummy;
- Edit_Buffer^.Column := Col;
- if Col < Edit_Buffer^.X2 - Edit_Buffer^.X1 then
- Edit_Buffer^.SCRX := Col
- else
- Edit_Buffer^.SCRX := Edit_Buffer^.X2-Edit_Buffer^.X1;
- end
- else
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,127) + #31;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row+1]^ := Copy(Dummy,128,256);
- End_Of_Line;
- end;
- end;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Do_Tab;
-
- begin
- if Edit_Buffer^.TabMarks[Edit_Buffer^.Column] then
- One_Char_Right;
- While not(Edit_Buffer^.TabMarks[Edit_Buffer^.Column]) do
- One_Char_Right;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Reset_TAB;
-
- Var
- Loop : Byte;
-
- begin
- Error_Message('New Tab : ');
- GotoXY(Edit_Buffer^.X1+10,Edit_Buffer^.Y2+1);
- ReadLn(Edit_Buffer^.TabWidth);
- if Edit_Buffer^.TabWidth > 32 then
- Edit_Buffer^.TabWidth := 32;
- for Loop := 1 to MAX_LEN do { loop on width }
- begin
- if Loop mod Edit_Buffer^.TabWidth = 0 then
- Edit_Buffer^.TabMarks[Loop] := TRUE
- else { set tab markers }
- Edit_Buffer^.TabMarks[Loop] := FALSE;
- end;
- Put_Bottom_Line;
- Reset_Colors;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Do_Help;
-
- begin
- if @Edit_Buffer^.HP <> NIL then
- Edit_Buffer^.HP;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Save_File(Name : String);
-
- Var
- Loop : word;
- OutFile : Text; { the file }
- Dummy : string; { dummy string }
-
- begin
- assign(OutFile,Name); { set the file name }
- {$I-}
- rewrite(OutFile); { open it }
- {$I+}
- if IOResult <> 0 then { no can do }
- begin
- Error_Message('Write Error : '+Name); { put a little message }
- Exit; { then get oput of here }
- Close(OutFile); { close the file }
- end;
- Error_Message('Saving '+UpCaseStr(Name)+'...'); { put a prompt }
- HiddenCursor; { hide the cursor }
- for Loop := 1 to Edit_Buffer^.NoLines do { loop until end of file }
- begin
- if Edit_Buffer^.TextBuffer^[Loop] <> NIL then
- WriteLn(OutFile,copy(Edit_Buffer^.TextBuffer^[Loop]^,1,
- length(Edit_Buffer^.TextBuffer^[Loop]^)-1));
- end;
- Close(OutFile); { close the file }
- Put_Bottom_Line; { draw the bottom line }
- NormalCursor; { restore cursor }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Load_New_File;
-
- Var
- Name : string;
-
- begin
- if @Edit_Buffer^.DP <> NIL then
- begin
- Name := Edit_Buffer^.DP;
- end
- else
- begin
- Error_Message('New File : ');
- GotoXY(Edit_Buffer^.X1 + 11,Edit_Buffer^.Y2+1);
- ReadLn(Name);
- end;
- if Name = ''
- then Exit;
- Erase_Buffer;
- Put_Top_Line;
- Load_File(Name);
- Jump_Start_Of_File;
- Reset_Block_Markers;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Search;
-
- var
- Temp : string[30];
- Loop,
- Pointer,
- Line,
- Len : word;
-
- begin
- Error_Message('Search : ó'+SearchString+'ú ');
- Temp := '';
- ReadLn(Temp);
- Reset_Colors;
- if Temp <> '' then
- SearchString := temp;
- Len := length(SearchString);
- if Len = 0 then
- begin
- Jump_Start_Of_File;
- Exit;
- end;
- Error_Message('Searching .......');
- Reset_Colors;
-
- for Loop := Edit_Buffer^.Row to Edit_Buffer^.NoLines do
- begin
- Pointer := pos(SearchString,Edit_Buffer^.TextBuffer^[Loop]^);
- if (Pointer > 0) then
- begin
- Edit_Buffer^.Row := Loop;
- Edit_Buffer^.Column := Pointer;
- Draw_All_Screen;
- Exit;
- end;
- end;
- Error_Message('Search string not found.');
- Reset_Colors;
- Repeat until KeyPressed;
- Loop := ord(ReadKey);
- Delay(100);
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Search_And_Replace;
-
- var
- Temp : string[30];
- Loop,
- Position,
- Pointer,
- Line,
- Len : word;
- Choice : char;
-
- begin
- Error_Message('Search for ó'+SearchString+'ú ');
- Temp := '';
- ReadLn(Temp);
- if Temp <> '' then
- SearchString := temp;
- Len := length(SearchString);
- if Len = 0 then
- begin
- Jump_Start_Of_File;
- Reset_Colors;
- Exit;
- end;
-
- Error_Message('Replace With ó'+ReplaceString+'ú ');
- Temp := '';
- ReadLn(Temp);
- if Temp <> '' then
- ReplaceString := temp;
- Len := length(ReplaceString);
-
- Error_Message('Searching......');
- Reset_Colors;
- for Line := 1 to Edit_Buffer^.NoLines do
- begin
- Position := pos(SearchString,Edit_Buffer^.TextBuffer^[Line]^);
- while (Position > 0) do
- begin
- Reset_Colors;
- Edit_Buffer^.Row := Line;
- Edit_Buffer^.Column := Position;
- Draw_All_Screen;
- TextColor(Edit_Buffer^.PromptCol);
- Write(SearchString);
- Reset_Colors;
- Error_Message('Replace (Y/N/ESC)? ');
- Repeat Until KeyPressed;
- Choice := ReadKey;
- Reset_Colors;
- if Choice = #27 then
- begin
- Begin_Of_Line;
- Jump_Start_Of_File;
- Exit;
- end;
- Error_Message('Searching......');
- if Choice in ['y','Y'] then
- begin
- Edit_Buffer^.TextBuffer^[Line]^ :=
- Copy(Edit_Buffer^.TextBuffer^[Line]^, 1,Position-1) +
- ReplaceString +
- Copy(Edit_Buffer^.TextBuffer^[Line]^,Position+Length(SearchString),MAX_LEN);
- Position := pos(SearchString,
- Copy(Edit_Buffer^.TextBuffer^[Line]^,
- Position+Length(ReplaceString)+1,128));
- end
- else
- Position := Pos(SearchString,Copy(Edit_Buffer^.TextBuffer^[Line]^,
- Position + Length(SearchString)+1,128)) +
- Position + Length(SearchString);
-
- Reset_Colors;
- end;
- end;
-
- Error_Message('End of Replace');
- Repeat until KeyPressed;
- Choice := ReadKey;
- Delay(100);
- Reset_Colors;
- end;
-
-
-
- {---------------------------------------------------------------------------}
-
- procedure Quit_Check;
-
- begin
- if Edit_Buffer^.Saved then
- Edit_Buffer^.Done := TRUE
- else
- begin
- Error_Message('Save Y/N ');
- GotoXY(Edit_Buffer^.X1+10,Edit_Buffer^.Y2+1);
- repeat until KeyPressed;
- if ReadKey in ['Y','y'] then
- Save_File(Edit_Buffer^.FileName);
- Edit_Buffer^.Done := TRUE;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Word_Back;
-
- begin
- if Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ' then
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ') do
- One_Char_Left;
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] <> ' ') do
- One_Char_Left;
- One_Char_Right;
- end
- else
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] <> ' ') do
- One_Char_Left;
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ') do
- One_Char_Left;
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] <> ' ') do
- One_Char_Left;
- One_Char_Right;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure One_Word_Forward;
-
- begin
- if Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ' then
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ') do
- One_Char_Right;
- end
- else
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] <> ' ') do
- One_Char_Right;
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ') do
- One_Char_Right;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Mark_Start;
-
- begin
- Edit_Buffer^.Block.BC := Edit_Buffer^.Column;
- Edit_Buffer^.Block.BL := Edit_Buffer^.Row;
- if (Edit_Buffer^.Block.EC = Edit_Buffer^.Block.BC) and
- (Edit_Buffer^.Block.EL = Edit_Buffer^.Block.BL) then
- Reset_Block_Markers;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Mark_End;
-
- begin
- Edit_Buffer^.Block.EC := Edit_Buffer^.Column;
- Edit_Buffer^.Block.EL := Edit_Buffer^.Row;
- if (Edit_Buffer^.Block.EC = Edit_Buffer^.Block.BC) and
- (Edit_Buffer^.Block.EL = Edit_Buffer^.Block.BL) then
- Reset_Block_Markers;
- if Edit_Buffer^.Block.EC = 1 then
- begin
- Dec(Edit_Buffer^.Block.EL);
- Edit_Buffer^.Block.EC := 255;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Copy;
-
- Var
- Hold,
- Dummy : string;
- DumDum,
- OldRow,
- Loop : word;
-
- begin
- if (Edit_Buffer^.Block.BC = 0) or (Edit_Buffer^.Block.EC = 0) or
- (Edit_Buffer^.Block.BL = 0) or (Edit_Buffer^.Block.EL = 0) then
- begin
- Reset_Block_Markers;
- Exit;
- end;
- if Edit_Buffer^.Block.BL = Edit_Buffer^.Block.EL then
- begin
- Dummy := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^;
- Hold := Copy(Dummy,Edit_Buffer^.Column+1,MAX_LEN);
- Dummy := Copy(Dummy,1,Edit_Buffer^.Column) +
- Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,
- Edit_Buffer^.Block.EC-Edit_Buffer^.Block.BC)+Hold;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN);
- Edit_Buffer^.Block.BL := Edit_Buffer^.Row;
- Edit_Buffer^.Block.EL := Edit_Buffer^.Row;
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256)+#31;
- Edit_Buffer^.Block.EL := Edit_Buffer^.Row;
- end;
- Edit_Buffer^.Block.EC := Edit_Buffer^.Column +
- (Edit_Buffer^.Block.EC-Edit_Buffer^.Block.BC);
- Edit_Buffer^.Block.BC := Edit_Buffer^.Column;
- end
- else
- begin
- DumDum := 0;
- OldRow := Edit_Buffer^.Row;
- Dummy := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^;
- Hold := Copy(Dummy,Edit_Buffer^.Column+1,MAX_LEN);
- Dummy := Copy(Dummy,1,Edit_Buffer^.Column) +
- Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,
- Edit_Buffer^.Block.EC-Edit_Buffer^.Block.BC);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN);
- Edit_Buffer^.Block.BC := Edit_Buffer^.Column;
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- if Edit_Buffer^.Row < Edit_Buffer^.Block.EL then
- inc(DumDum);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256);
- end;
- for Loop := Edit_Buffer^.Block.BL+1 to Edit_Buffer^.Block.EL-1 do
- begin
- One_Line_Down;
- Insert_One_Line;
- if Edit_Buffer^.Row < Edit_Buffer^.Block.EL then
- begin
- inc(DumDum);
- end;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ :=
- Edit_Buffer^.TextBuffer^[Loop+DumDum]^;
- end;
- One_Line_Down;
- Insert_One_Line;
- if Edit_Buffer^.Row < Edit_Buffer^.Block.EL then
- inc(DumDum);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ :=
- Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.EL+DumDum]^,1,Edit_Buffer^.Block.EC);
- Edit_Buffer^.Block.EC := length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ :=
- Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,1,
- length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^)-1) + Hold;
- Dummy := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^;
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256);
- end;
- Edit_Buffer^.Block.EL := Edit_Buffer^.Row;
- Edit_Buffer^.Block.BL := OldRow;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Erase;
-
- Var
- OLDROW,
- OLDSY,
- OLDSX : byte;
- Loop : word;
- Dummy,
- ELStr,
- BLStr : string;
-
-
- begin
- if (Edit_Buffer^.Block.BC = 0) or (Edit_Buffer^.Block.EC = 0) or
- (Edit_Buffer^.Block.BL = 0) or (Edit_Buffer^.Block.EL = 0) then
- begin
- Reset_Block_Markers;
- Exit;
- end;
- OLDROW := Edit_Buffer^.Row;
- OLDSY := Edit_Buffer^.SCRY;
- OLDSX := Edit_Buffer^.SCRX;
- ELStr := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.EL]^;
- BLStr := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^;
- Edit_Buffer^.Row := Edit_Buffer^.Block.BL;
- if Edit_Buffer^.Block.BL = Edit_Buffer^.Block.EL then
- Delete_One_Line
- else
- begin
- for Loop := 0 to Edit_Buffer^.Block.EL - Edit_Buffer^.Block.BL do
- Delete_One_Line;
- end;
- if (Edit_Buffer^.Block.BC > 1) or (Edit_Buffer^.Block.EC < MAX_LEN) then
- begin
- Insert_One_Line;
- Dummy := copy(BLStr,1,Edit_Buffer^.Block.BC-1) +
- copy(ELStr,Edit_Buffer^.Block.EC+1,MAX_LEN);
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Dummy;
- end;
- Reset_Block_Markers;
- Edit_Buffer^.Row := OLDROW;
- Edit_Buffer^.SCRY := OLDSY;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Read;
-
- Var
- InStr,
- Hold,
- Dummy : string;
- InFile : text;
-
- begin
- Reset_Block_Markers;
- if @Edit_Buffer^.DP <> NIL then
- begin
- InStr := Edit_Buffer^.DP;
- end
- else
- begin
- Error_Message('From File : ');
- GotoXY(13,Edit_Buffer^.Y2+1);
- ReadLn(InStr);
- end;
- assign(InFile,InStr);
- {$I-}
- reset(InFile);
- {$I+}
- if IOResult <> 0 then
- begin
- Error_Message('Can not open '+InStr);
- Exit;
- end;
- Dummy := Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,1,Edit_Buffer^.Column);
- Hold := Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^,Edit_Buffer^.Column+1,MAX_LEN);
- Edit_Buffer^.Block.BC := Edit_Buffer^.Column;
- Edit_Buffer^.Block.BL := Edit_Buffer^.Row;
- ReadLn(InFile,InStr);
- Dummy := Dummy+InStr;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN);
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256)+#31;
- end;
- while not eof(InFile) do
- begin
- ReadLn(InFile,InStr);
- One_Line_Down;
- Insert_One_Line;
- Dummy := InStr;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN);
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256)+#31;
- end;
- end;
- Dummy := Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^+Hold;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN);
- if length(Dummy) > MAX_LEN then
- begin
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,1,MAX_LEN)+#31;
- One_Line_Down;
- Insert_One_Line;
- Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^ := Copy(Dummy,MAX_LEN,256)+#31;
- end;
- Edit_Buffer^.Block.EL := Edit_Buffer^.Row;
- Edit_Buffer^.Block.EC := length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^);
- Close(InFile);
- Put_Bottom_Line;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Write;
-
- Var
- Dummy : string;
- OutF : text;
- Loop : word;
-
- begin
- if (Edit_Buffer^.Block.BC = 0) or (Edit_Buffer^.Block.EC = 0) or
- (Edit_Buffer^.Block.BL = 0) or (Edit_Buffer^.Block.EL = 0) then
- begin
- Reset_Block_Markers;
- Exit;
- end;
- if @Edit_Buffer^.DP <> NIL then
- begin
- Dummy := Edit_Buffer^.DP;
- end
- else
- begin
- Error_Message('To File : ');
- GotoXY(11,Edit_Buffer^.Y2+1);
- ReadLn(Dummy);
- end;
- assign(OutF,Dummy);
- {$I-}
- rewrite(OutF);
- {$I+}
- if IoResult <> 0 then
- begin
- Error_Message('Can not open '+Dummy);
- Exit;
- end;
- if Edit_Buffer^.Block.BL = Edit_Buffer^.Block.EL then
- begin
- WriteLn(OutF,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,
- Edit_Buffer^.Block.EC-Edit_Buffer^.Block.BC));
- end
- else
- begin
- WriteLn(OutF,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^)-1));
- if Edit_Buffer^.Block.EL = Edit_Buffer^.Block.BL + 1 then
- begin
- WriteLn(OutF,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL+1]^,
- 1,Edit_Buffer^.Block.EC));
- end
- else
- begin
- for Loop := Edit_Buffer^.Block.BL+1 to Edit_Buffer^.Block.EL-1 do
- WriteLn(OutF,Copy(Edit_Buffer^.TextBuffer^[Loop]^,1,length(Edit_Buffer^.TextBuffer^[Loop]^)-1));
- WriteLn(OutF,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL+1]^,
- 1,Edit_Buffer^.Block.EC));
- end;
- end;
- Close(OutF);
- Put_Bottom_Line;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Move;
-
- Var
- BC1,BL1,EC1,EL1 : word;
-
- begin
- BC1 := Edit_Buffer^.Block.BC;
- BL1 := Edit_Buffer^.Block.BL;
- EC1 := Edit_Buffer^.Block.EC;
- EL1 := Edit_Buffer^.Block.EL;
- Block_Copy;
- Edit_Buffer^.Block.BC := BC1;
- Edit_Buffer^.Block.BL := BL1;
- Edit_Buffer^.Block.EC := EC1;
- Edit_Buffer^.Block.EL := EL1;
- Block_Erase;
- Reset_Block_Markers;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Block_Print;
-
- Var
- Dummy : string;
- Loop : word;
-
- begin
- if (Edit_Buffer^.Block.BC = 0) or (Edit_Buffer^.Block.EC = 0) or
- (Edit_Buffer^.Block.BL = 0) or (Edit_Buffer^.Block.EL = 0) then
- begin
- Reset_Block_Markers;
- Exit;
- end;
- Error_Message('Printing......');
- WriteLn(Lst);
- if Edit_Buffer^.Block.BL = Edit_Buffer^.Block.EL then
- begin
- WriteLn(Lst,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,
- Edit_Buffer^.Block.EC-Edit_Buffer^.Block.BC));
- end
- else
- begin
- WriteLn(Lst,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^,
- Edit_Buffer^.Block.BC,length(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL]^)-1));
- if Edit_Buffer^.Block.EL = Edit_Buffer^.Block.BL + 1 then
- begin
- WriteLn(Lst,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL+1]^,
- 1,Edit_Buffer^.Block.EC));
- end
- else
- begin
- for Loop := Edit_Buffer^.Block.BL+1 to Edit_Buffer^.Block.EL-1 do
- WriteLn(Lst,copy(Edit_Buffer^.TextBuffer^[Loop]^,1,length(Edit_Buffer^.TextBuffer^[loop]^)-1));
- WriteLn(Lst,Copy(Edit_Buffer^.TextBuffer^[Edit_Buffer^.Block.BL+1]^,
- 1,Edit_Buffer^.Block.EC));
- end;
- end;
- Put_Bottom_Line;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Print_File;
-
- Var
- Loop : word;
- Dummy : string; { dummy string }
-
- begin
- Error_Message('Printing..... '); { put a prompt }
- HiddenCursor; { hide the cursor }
- for Loop := 1 to Edit_Buffer^.NoLines do { loop until end of file }
- begin
- if Edit_Buffer^.TextBuffer^[Loop] <> NIL then
- WriteLn(Lst,copy(Edit_Buffer^.TextBuffer^[Loop]^,1,
- length(Edit_Buffer^.TextBuffer^[Loop]^)-1));
- end;
- Put_Bottom_Line; { draw the bottom line }
- NormalCursor; { restore cursor }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Erase_One_Word;
-
- begin
- if Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ' then
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] = ' ') do
- Delete_One_Char;
- end
- else
- begin
- while (Edit_Buffer^.TextBuffer^[Edit_Buffer^.Row]^[Edit_Buffer^.Column] <> ' ') do
- Delete_One_Char;
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Pass_Chars_On(Pass : ChrSet);
-
- begin
- if @Edit_Buffer^.PP <> NIL then
- Edit_Buffer^.PP(Pass);
- end;
-
- {---------------------------------------------------------------------------}
-
- begin
- end.