-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathed2.pas
737 lines (697 loc) · 18.5 KB
/
ed2.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
{/////////////////////////////////////////////////////////////////////////
//
// Dos Navigator Open Source 1.51.08
// Based on Dos Navigator (C) 1991-99 RIT Research Labs
//
// This programs is free for commercial and non-commercial use as long as
// the following conditions are aheared to.
//
// Copyright remains RIT Research Labs, and as such any Copyright notices
// in the code are not to be removed. If this package is used in a
// product, RIT Research Labs should be given attribution as the RIT Research
// Labs of the parts of the library used. This can be in the form of a textual
// message at program startup or in documentation (online or textual)
// provided with the package.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// "Based on Dos Navigator by RIT Research Labs."
//
// THIS SOFTWARE IS PROVIDED BY RIT RESEARCH LABS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The licence and distribution terms for any publically available
// version or derivative of this code cannot be changed. i.e. this code
// cannot simply be copied and put under another distribution licence
// (including the GNU Public Licence).
//
//////////////////////////////////////////////////////////////////////////}
{$I STDEFINE.INC}
unit ed2;
interface
uses
Commands, UKeyMap, Objects, Views, Drivers, Defines, Streams,
Lfnvp {, SBlocks}
;
{ TDoCollection }
const
maxUndo = 100;
udDelChar = 1;
udInsChar = 2;
udDelLine = 3;
udInsLine = 4;
udDelBlock = 5;
udInsBlock = 6;
udBackDel = 7;
udSubDel = 8;
udSubDelLine = 9;
udIndentBlock = 10;
udUnindentBlock = 11;
udInsVertBlock = 12;
udReplace = 13;
udReplaceChar = 14;
udReplaceBlock = 15;
udClearBlock = 16;
udStrModified = 17;
udDupeLine = 18;
udFormatBlock = 19;
udReplaceAll = 20; {-$VOL}
type
TDoKind = (dkRedo, dkUndo); {-$VOL}
PUndoRec = ^TUndoRec;
TUndoRec = record
What: Word;
Where: TPoint;
KeyMap: TKeyMap; {-$VIV}
case Word of
udDelChar: (Str: PLongString);
udInsChar: (Count, Width: Integer; Block: TRect);
udDelLine: (Lines: PCollection; Vertical, InsM: Boolean);
end;
PDoCollection = ^TDoCollection;
TDoCollection = object(TCollection)
DoKind: TDoKind; {-$VOL}
procedure FreeItem(P: Pointer); virtual;
constructor Init(ReOrUn_do: TDoKind); {-$VOL}
end;
{ TInfoLine }
PInfoLine = ^TInfoLine;
TInfoLine = object(TView)
constructor Init(var R: TRect);
procedure Draw; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
end;
{ TBookmarkLine }
PBookmarkLine = ^TBookmarkLine;
TBookmarkLine = object(TView)
procedure Draw; virtual;
end;
{ TAttrBufStream }
PAttrBufStream = ^TAttrBufStream;
TAttrBufStream = object(TBufStream)
OldAttr: Word;
F: lFile;
constructor Init(FileName: String; Mode, Size: Word);
destructor Done; virtual;
end;
function CheckForOver(Name: String): PStream;
procedure WriteBlock(Hint: String; S: PStream; C: PLineCollection
{PCollector}; ForcedCRLF: TCRLF; AOptimalFill: Boolean); {-SBlocks}
implementation
uses
Advance, Advance1, Advance2
, Messages, Dos, DNApp, Microed, Startup, DnIni, EdWin
;
{ TDoCollection }
procedure TDoCollection.FreeItem(P: Pointer);
var
T: PUndoRec;
begin
T := P;
if P = nil then
Exit;
case DoKind of
dkUndo:
case T^.What of
udDelChar, udInsLine, udSubDelLine, udReplace, udReplaceChar,
udInsBlock,
udFormatBlock, udStrModified, udSubDel, udBackDel, udReplaceAll:
DisposeLongStr(T^.Str);
udDelLine, udDelBlock, udReplaceBlock,
udClearBlock:
begin
Dispose(T^.Lines, Done);
T^.Lines := nil
end;
udInsChar:
begin
end;
end {case};
dkRedo:
case T^.What of
udInsChar, udSubDel, udReplaceChar, udSubDelLine, udStrModified,
udReplace,
udReplaceAll:
DisposeLongStr(T^.Str);
udInsLine, udInsBlock, udFormatBlock, udDelBlock, udInsVertBlock,
udReplaceBlock, udClearBlock:
begin
Dispose(T^.Lines, Done);
T^.Lines := nil
end;
udDelChar, udDelLine, udBackDel:
begin
end;
end {case};
end {case};
Dispose(T);
end { TDoCollection.FreeItem };
constructor TDoCollection.Init(ReOrUn_do: TDoKind); {-$VOL}
begin
inherited Init($100, $80);
DoKind := ReOrUn_do;
end; {-$VOL}
{ TInfoLine }
constructor TInfoLine.Init;
begin
inherited Init(R);
EventMask := evMouseDown;
GrowMode := gfGrowHiX+gfGrowHiY+gfGrowLoY;
end;
procedure TInfoLine.HandleEvent;
var
T: TPoint;
{ lS: byte; }
P: PFileEditor;
Ev: TEvent;
BookMark: Byte;
begin
inherited HandleEvent(Event);
if Event.What = evMouseDown then
begin
Owner^.MakeLocal(Event.Where, T);
if T.X >= Owner^.Size.X-2 then
begin
PWindow(Owner)^.Frame^.HandleEvent(Event);
Exit;
end;
MakeLocal(Event.Where, T);
Event.What := evCommand;
{==0000000:000=[000 00]=(-)==CrLf=DOS==<1........>}
{00000000001111111111222222222233333333334444444444}
{01234567890123456789012345678901234567890123456789}
P := PFileEditor(PEditWindow(Owner)^.Intern);
if (T.X > 1) and (T.X < 12) then
Event.Command := cmGotoLineNumber
else if (T.X > 12) and (T.X < 21) then
Event.Command := cmSpecChar
else if (T.X > 21) and (T.X < 25) then
Event.Command := cmSwitchBlock
else if (T.X > 26) and (T.X < 31) then
case P^.EdOpt.ForcedCRLF of
cfCRLF:
Event.Command := cmEditLfMode;
cfLF:
Event.Command := cmEditCrMode;
cfCR:
Event.Command := cmEditCrLfMode;
else {case}
Event.Command := cmEditCrLfMode;
end
else if (T.X > 31) and (T.X < 35) then
Event.Command := cmSwitchKeyMapping
else if (T.X = 37) then
PFileEditor(Owner^.Current)^.ScrollTo(0, 0) {AK155}
else if FastBookmark and ((T.X > 37) and (T.X < 47)) then
begin
BookMark := T.X-38;
if (Event.Buttons and mbRightButton <> 0) or
(not P^.MarkPos[Event.InfoByte].EqualsXY(-1, -1))
then
with Event do
begin
What := evCommand;
if (Event.Buttons and mbRightButton <> 0)
then
Command := cmPlaceMarker1+BookMark
else
Command := cmGoToMarker1+BookMark;
end
else
Event.What := evNothing;
end
else if (T.X = 47) then
with PFileEditor(Owner^.Current) do
ScrollTo(0, FileLines^.Count) {AK155}
else
Event.What := evNothing;
if Event.What <> evNothing then
PutEvent(Event);
ClearEvent(Event);
end;
end { TInfoLine.HandleEvent };
procedure TInfoLine.Draw;
var
P: PFileEditor;
X, Y: LongInt;
C: Char;
S: String;
CharNum: Byte; {-$VIV}
Ch: Char;
Ch2: Char;
Color: Byte;
qwe: Byte;
B: TDrawBuffer;
begin
P := PFileEditor(PEditWindow(Owner)^.Intern);
if Owner^.GetState(sfDragging) or not Owner^.GetState(sfActive) then
begin
if Owner^.GetState(sfDragging)
then
Color := PWindow(Owner)^.Frame^.GetColor(5)
else
Color := PWindow(Owner)^.Frame^.GetColor(2);
Ch2 := #196;
end
else
begin
Color := PWindow(Owner)^.Frame^.GetColor(3);
Ch2 := #205;
end;
if not Owner^.GetState(sfActive) then
SetLength(S, 0)
else
begin
with P^ do
begin
X := Delta.X+1;
Y := Delta.Y+1;
if X <= Length(WorkString) then
C := WorkString[X]
else
C := #0;
end;
CharNum := Byte(KeyMapDescr[P^.KeyMap].XLatCP^[FromAscii][C]);
if P^.Modified then
S := #15+Ch2
else
S := Ch2+Ch2;
S := S+SStr(Y, 5, Ch2)+':'+SSt2(X, 4, Ch2)
+Ch2+'['+SStr(CharNum, 3, '0')+'ú'+Hex2(CharNum)+']'+Ch2;
{-$VIV}
if P^.DrawMode = 1 then
S := S+'{Å'
else if P^.DrawMode = 2 then
S := S+'{Î'
else if P^.VertBlock then
S := S+'('#18
else
S := S+'('#29;
if P^.DrawMode = 0 then
if P^.OptimalFill then
S := S+'F)'
else
S := S+')Í'
else if P^.OptimalFill then
S := S+'F}'
else
S := S+'}Í';
if P^.EdOpt.ForcedCRLF = cfNone then
begin
P^.EdOpt.ForcedCRLF := cfNone;
for qwe := 0 to EditorDefaults.NewLine do
P^.EdOpt.ForcedCRLF := Succ(P^.EdOpt.ForcedCRLF);
end;
if P^.EdOpt.ForcedCRLF = cfCR then
S := S+Ch2+Ch2+'Cr'+Ch2
else if P^.EdOpt.ForcedCRLF = cfLF then
S := S+Ch2+Ch2+'Lf'+Ch2
else if P^.EdOpt.ForcedCRLF = cfCRLF then
S := S+Ch2+'CrLf'
else
S := S+Ch2+'::::';
S := S+Ch2+KeyMapDescr[P^.KeyMap].Tag+Ch2;
if FastBookmark then
begin
S := S+Ch2+'<'; {-$VIV 20.05.99--}
for X := 1 to 9 do
if not P^.MarkPos[X].EqualsXY(-1, -1)
then
S := S+Char(X+48)
else
S := S+#250;
S := S+'>'; {-$VIV::}
end;
end;
MoveChar(B, Ch2, Color, Size.X);
MoveStr(B, S, Color);
WriteLine(0, 0, Size.X, 1, B);
end { TInfoLine.Draw };
{TBookmarkLine}
procedure TBookmarkLine.Draw;
var
P: PFileEditor;
Col: Byte;
I: Integer;
Mrk: Char;
Ch: Char;
B: array[0..20] of AWord;
function IsMarker(pLine: LongInt): Char;
var
I: Byte;
begin
IsMarker := #0;
for I := 1 to 9 do
if P^.MarkPos[I].Y = pLine then
begin
IsMarker := Char(I+48);
Break;
end;
end;
function SwitchHalfs(B: Byte): Byte;
begin
SwitchHalfs := ((B and $0F) shl 4) or ((B and $F0) shr 4);
end;
begin { TBookmarkLine.Draw }
P := PFileEditor(PEditWindow(Owner)^.Intern);
if Owner^.GetState(sfDragging) or not Owner^.GetState(sfActive) then
begin
if Owner^.GetState(sfDragging)
then
Col := PWindow(Owner)^.Frame^.GetColor(5)
else
Col := PWindow(Owner)^.Frame^.GetColor(2);
Ch := #179;
end
else
begin
Col := PWindow(Owner)^.Frame^.GetColor(3);
Ch := #186;
end;
if not ShowBookmarks then
begin
MoveChar(B, Ch, Col, 1); {SYR}
WriteLine(0, 0, Size.X, Size.Y, B);
Exit;
end;
for I := 0 to Size.Y do
begin
Mrk := IsMarker(P^.Pos.Y+I);
if Mrk = #0 then
MoveChar(B, Ch, Col, 1) {SYR}
else
MoveChar(B, Mrk, SwitchHalfs(Col), 1);
WriteLine(0, I, Size.X, 1, B);
end;
end { TBookmarkLine.Draw };
constructor TAttrBufStream.Init(FileName: String; Mode, Size: Word);
begin
inherited Init(FileName, Mode, Size);
OldAttr := $FFFF;
end;
destructor TAttrBufStream.Done;
begin
inherited Done;
if OldAttr <> $FFFF then
lSetFAttr(F, OldAttr);
end;
{-DataCompBoy-}
function CheckForOver(Name: String): PStream; {<Microed2.001>}
var
S: PAttrBufStream;
F: lFile;
W: Word;
L: array[0..0] of LongInt;
Attr: Word;
procedure CreateBackup;
var
Dr: String;
Nm: String;
Xt: String;
begin
lFSplit(Name, Dr, Nm, Xt);
ClrIO;
EraseFile(Dr+Nm+'.BAK');
lChangeFileName(Name, Dr+Nm+'.BAK');
ClrIO;
end;
procedure OverQuery;
var
P: PString;
Dr: String[30];
begin
P := @Dr;
Dr := Cut(Name, 30);
W := Msg(dlED_OverQuery, @P,
mfYesButton+mfCancelButton+mfAppendButton+mfWarning);
end;
begin { CheckForOver }
CheckForOver := nil;
Abort := False;
S := nil;
lAssignFile(F, Name);
ClrIO;
lGetFAttr(F, Attr);
if Abort then
Exit;
if (DosError = 0) and (Attr and ReadOnly <> 0) then
begin
OverQuery;
case W of
cmYes, cmOK:
;
else {case}
Exit
end {case};
Pointer(L[0]) := @Name;
if Msg(dlED_ModifyRO, @L, mfConfirmation+mfOKCancel) <> cmOK then
Exit;
lSetFAttr(F, Archive);
if Abort or (DosError <> 0) then
begin
CantWrite(Name);
Exit;
end;
end
else
begin
W := $FFFF;
Attr := Archive
end;
New(S, Init(Name, stOpen, 4096));
if S = nil then
Exit;
if Abort or (S^.Status = stOK) then
begin
if W = $FFFF then
OverQuery;
case W of
cmYes, cmOK:
begin
if Attr and ReadOnly <> 0 then
begin
S^.OldAttr := Attr;
lAssignFile(S^.F, lFileNameOf(F));
end;
case W of
cmYes:
S^.Truncate;
cmOK:
S^.Seek(S^.GetSize);
end {case};
CheckForOver := S;
end;
else {case}
begin
Dispose(S, Done);
S := nil;
end;
end {case};
Exit;
end;
Dispose(S, Done);
S := nil;
if Abort then
Exit;
{AK155 13/03/2006
®«¥§®áâì CreateBackup ®ç¥ì ᮬ¨â¥«ì . î¤ ¬®¦® ¯®¯ áâì
⮫쪮 ¥á«¨ ¯à¨ ®âªàë⨨ á stOpen ¯®«ã稫áï Status <> 0, çâ®, ᪮॥
¢á¥£®, ®¡®§ ç ¥â, çâ® ä ©« ¥â, â® ¥áâì Backup ¥ 㦥. § ¤à㣨å
¯à¨ç¨ Status <> 0 ¯à¨å®¤¨â ¢ £®«®¢ã ⮫쪮 ¥å¢ ⪠¯ ¬ï⨠¡ãä¥à.
ª ¢ í⮬ á«ãç ¥ ¤® ¥ ¡íª ¯ á®§¤ ¢ âì, çâ®-â® á ¯ ¬ïâìî
¯à¨¤ã¬ë¢ âì, ¯®áª®«ìªã ¯à¨ ®âªàë⨨ á stCreate ¯ ¬ï⨠®¯ïâì â ª¨
¥ å¢ â¨â, ® ¯®«ì§®¢ â¥«î ¬ë í⮣® ¥ ᪠¦¥¬, ¨, ¡®«¥¥ ⮣®,
¬®¦®, ¢¥à®, 㯠áâì ¢ CantWrite ¨«¨ ¥ ¢ë¤ âì ¨ª ª®£® á®®¡é¥¨ï.
ª çâ® «ãçè¥ ¡ë ¯à® «¨§¨à®¢ âì ¯à¨ç¨ã Status <> 0 ¨ ᤥ« âì
çâ®-â® ¡®«¥¥ ®á¬ëá«¥®¥, 祬 â®, çâ® âãâ ¨¬¥¥âáï ᥩç á. }
if EditorDefaults.EdOpt and ebfCBF <> 0 then
CreateBackup;
New(S, Init(Name, stCreate, 4096));
if Abort or (S = nil) or (S^.Status <> stOK) then
begin
CantWrite(Name);
Dispose(S, Done);
S := nil;
Exit
end;
CheckForOver := S;
end { CheckForOver };
{-DataCompBoy-}
procedure WriteBlock(Hint: String; S: PStream; C: PLineCollection
{PCollector}; ForcedCRLF: TCRLF; AOptimalFill: Boolean); {-SBlocks}
var
I: LongInt;
M: LongInt;
SST: LongString;
P: PLongString;
{Cat: íâ ¯à®æ¥¤ãà ⥯¥àì 㬥¥â à ¡®â âì á ¤«¨ë¬¨ áâப ¬¨
¨ 室¨âáï ¢ ¬®¤ã«¥ Advance1}
(*
procedure CompressString; {â , ª®â. ¯à¨ á®åà ¥¨¨ ä ©« }
var PP: Pointer;
TSt: Integer;
begin
PP := @SST;
TSt := StoI(EditorDefaults.TabSize);
if TSt = 0 then TSt := 8;
{$IFNDEF BIT_32}
asm
les bx, PP
mov cl, es:[bx]
inc bx
xor ch, ch
jcxz @@Ex
xor di, di
xor si, si
mov byte ptr es:[bx-1], ch
@@1:
mov ah, byte ptr TSt
xor dx, dx
@@2:
mov al, es:[bx][si]
mov es:[bx][di], al
inc si
cmp si, cx
ja @@Ex
inc di
inc byte ptr es:[bx-1]
cmp al, ' '
jne @@3
inc dl
jmp @@4
@@3:
xor Dl, dl
@@4:
dec ah
jnz @@2
or dl, dl
jz @@5
dec dl
jz @@5
sub di, dx
sub byte ptr es:[bx-1], dl
mov al, 9
mov es:[bx][di-1], al
@@5:
jmp @@1
@@Ex:
end;
{$ELSE}
asm
push ebx
push edx
push edi
push esi
mov ebx, PP
xor ecx, ecx
mov cl, [ebx]
inc ebx
jcxz @@Ex
xor edi, edi
xor esi, esi
mov byte ptr [ebx-1], ch
@@1:
mov ah, byte ptr TSt
xor edx, edx
@@2:
mov al, [ebx+esi]
mov [ebx+edi], al
inc esi
cmp esi, ecx
ja @@Ex
inc edi
inc byte ptr [ebx-1]
cmp al, ' '
jne @@3
inc dl
jmp @@4
@@3:
xor dl, dl
@@4:
dec ah
jnz @@2
or dl, dl
jz @@5
dec dl
jz @@5
sub edi, edx
sub byte ptr [ebx-1], dl
mov al, 9
mov [ebx+edi-1], al
@@5:
jmp @@1
@@Ex:
pop esi
pop edi
pop edx
pop ebx
end;
{$ENDIF}
end;
*)
var
PP: PView;
CrLf: String[2];
qwe: Byte;
begin { WriteBlock }
if ForcedCRLF = cfNone then
begin
ForcedCRLF := cfNone;
for qwe := 0 to EditorDefaults.NewLine do
ForcedCRLF := Succ(ForcedCRLF);
end;
if ForcedCRLF = cfCR then
CrLf := #13
else if ForcedCRLF = cfLF then
CrLf := #10
else if ForcedCRLF = cfCRLF then
CrLf := #13#10;
I := 1;
if (S = nil) or (C = nil) then
Exit;
PP := WriteMsg(^M^M^C+GetString(dlWritingFile));
while not Abort and (S^.Status = stOK) and (I < C^.Count) do
begin
UpdateWriteView(PP);
P := C^.At(I-1);
if P <> nil then
{JO} {!!!}
SST := P^+CrLf
else
SST := CrLf; {JO}
if AOptimalFill then
CompressString(SST);
S^.Write(SST[1], Length(SST));
Inc(I);
end;
{HintString := '';}Application^.Idle;
P := C^.At(I-1);
if P <> nil then
SST := P^
else
SST := '';
if AOptimalFill then
CompressString(SST); {Cat: ¯à® ¯®á«¥¤îî áâபã ⮦¥ ¥ § ¡ë¢ ¥¬}
S^.Write(SST[1], Length(SST));
if PP <> nil then
PP^.Free;
end { WriteBlock };
end.