mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-10 07:29:41 +01:00
+ first partial syntax test
This commit is contained in:
parent
f7d2d5f021
commit
61eb9ead89
@ -17,7 +17,7 @@
|
|||||||
unit WEditor;
|
unit WEditor;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
{$tes}
|
{tes}
|
||||||
uses
|
uses
|
||||||
Dos,Objects,Drivers,Views,Menus,Commands,
|
Dos,Objects,Drivers,Views,Menus,Commands,
|
||||||
WUtils;
|
WUtils;
|
||||||
@ -25,7 +25,9 @@ uses
|
|||||||
|
|
||||||
{ try to only do syntax on part of file until current position
|
{ try to only do syntax on part of file until current position
|
||||||
does not work correctly yet PM }
|
does not work correctly yet PM }
|
||||||
{.$define TEST_PARTIAL_SYNTAX}
|
{$ifdef DEBUG}
|
||||||
|
{$define TEST_PARTIAL_SYNTAX}
|
||||||
|
{$endif DEBUG}
|
||||||
|
|
||||||
const
|
const
|
||||||
cmFileNameChanged = 51234;
|
cmFileNameChanged = 51234;
|
||||||
@ -471,10 +473,6 @@ const
|
|||||||
DefaultTabSize : integer = 8;
|
DefaultTabSize : integer = 8;
|
||||||
EOL : String[2] = {$ifdef Linux}#10;{$else}#13#10;{$endif}
|
EOL : String[2] = {$ifdef Linux}#10;{$else}#13#10;{$endif}
|
||||||
|
|
||||||
{ used for ShiftDel and ShiftIns to avoid
|
|
||||||
GetShiftState to be considered for extending
|
|
||||||
selection (PM) }
|
|
||||||
|
|
||||||
cmCopyWin = 240;
|
cmCopyWin = 240;
|
||||||
cmPasteWin = 241;
|
cmPasteWin = 241;
|
||||||
|
|
||||||
@ -485,7 +483,11 @@ const
|
|||||||
GotoID = 107;
|
GotoID = 107;
|
||||||
TextGrepId = 108;
|
TextGrepId = 108;
|
||||||
|
|
||||||
|
{ used for ShiftDel and ShiftIns to avoid
|
||||||
|
GetShiftState to be considered for extending
|
||||||
|
selection (PM) }
|
||||||
DontConsiderShiftState: boolean = false;
|
DontConsiderShiftState: boolean = false;
|
||||||
|
|
||||||
ToClipCmds : TCommandSet = ([cmCut,cmCopy,cmCopyWin]);
|
ToClipCmds : TCommandSet = ([cmCut,cmCopy,cmCopyWin]);
|
||||||
FromClipCmds : TCommandSet = ([cmPaste]);
|
FromClipCmds : TCommandSet = ([cmPaste]);
|
||||||
FromWinClipCmds : TCommandSet = ([cmPasteWin]);
|
FromWinClipCmds : TCommandSet = ([cmPasteWin]);
|
||||||
@ -1604,6 +1606,15 @@ begin
|
|||||||
if DontClear=false then
|
if DontClear=false then
|
||||||
ClearEvent(Event);
|
ClearEvent(Event);
|
||||||
end;
|
end;
|
||||||
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
|
evIdle :
|
||||||
|
begin
|
||||||
|
{ Complete syntax by 20 lines increment }
|
||||||
|
{ could already be quite lengthy on slow systems }
|
||||||
|
if not SyntaxComplete then
|
||||||
|
UpdateAttrsRange(LastSyntaxedLine,LastSyntaxedLine+20,AttrAll);
|
||||||
|
end;
|
||||||
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
evBroadcast :
|
evBroadcast :
|
||||||
begin
|
begin
|
||||||
CCAction:=ccDontCare;
|
CCAction:=ccDontCare;
|
||||||
@ -4287,6 +4298,8 @@ begin
|
|||||||
{$ifdef TEST_PARTIAL_SYNTAX}
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
LastSyntaxedLine:=GetLineCount;
|
LastSyntaxedLine:=GetLineCount;
|
||||||
SyntaxComplete:=true;
|
SyntaxComplete:=true;
|
||||||
|
{ no Idle necessary }
|
||||||
|
EventMask:=EventMask and not evIdle;
|
||||||
{$endif TEST_PARTIAL_SYNTAX}
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
UpdateIndicator;
|
UpdateIndicator;
|
||||||
Exit;
|
Exit;
|
||||||
@ -4354,7 +4367,7 @@ begin
|
|||||||
(OldLine^.EndsWithAsm=Line^.EndsWithAsm) and
|
(OldLine^.EndsWithAsm=Line^.EndsWithAsm) and
|
||||||
(OldLine^.EndsWithDirective=Line^.EndsWithDirective) and }
|
(OldLine^.EndsWithDirective=Line^.EndsWithDirective) and }
|
||||||
{$ifdef TEST_PARTIAL_SYNTAX}
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
(CurLine>=FromLine) and
|
(CurLine>FromLine) and
|
||||||
{$endif TEST_PARTIAL_SYNTAX}
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
(NextLine^.BeginsWithAsm=Line^.EndsWithAsm) and
|
(NextLine^.BeginsWithAsm=Line^.EndsWithAsm) and
|
||||||
(NextLine^.BeginsWithComment=Line^.EndsWithComment) and
|
(NextLine^.BeginsWithComment=Line^.EndsWithComment) and
|
||||||
@ -4363,13 +4376,16 @@ begin
|
|||||||
(NextLine^.Format<>nil) then
|
(NextLine^.Format<>nil) then
|
||||||
Break;
|
Break;
|
||||||
{$ifdef TEST_PARTIAL_SYNTAX}
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
if (CurLine<GetLineCount ) and
|
if (CurLine<GetLineCount) and
|
||||||
|
(CurLine>FromLine) and
|
||||||
((Attrs and attrForceFull)=0) and
|
((Attrs and attrForceFull)=0) and
|
||||||
(CurLine>Delta.Y+Size.Y) then
|
(CurLine>Delta.Y+Size.Y) then
|
||||||
begin
|
begin
|
||||||
If SyntaxComplete then
|
If SyntaxComplete then
|
||||||
begin
|
begin
|
||||||
SyntaxComplete:=false;
|
SyntaxComplete:=false;
|
||||||
|
{ no Idle necessary }
|
||||||
|
EventMask:=EventMask or evIdle;
|
||||||
UpdateIndicator;
|
UpdateIndicator;
|
||||||
end;
|
end;
|
||||||
LastSyntaxedLine:=CurLine-1;
|
LastSyntaxedLine:=CurLine-1;
|
||||||
@ -4385,6 +4401,8 @@ begin
|
|||||||
if CurLine=GetLineCount then
|
if CurLine=GetLineCount then
|
||||||
begin
|
begin
|
||||||
SyntaxComplete:=true;
|
SyntaxComplete:=true;
|
||||||
|
{ no Idle necessary }
|
||||||
|
EventMask:=EventMask and not evIdle;
|
||||||
UpdateIndicator;
|
UpdateIndicator;
|
||||||
end;
|
end;
|
||||||
{$endif TEST_PARTIAL_SYNTAX}
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
@ -4757,6 +4775,8 @@ begin
|
|||||||
New(TS, Init(@S,S.GetPos,TSize));
|
New(TS, Init(@S,S.GetPos,TSize));
|
||||||
{$ifdef TEST_PARTIAL_SYNTAX}
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
SyntaxComplete:=false;
|
SyntaxComplete:=false;
|
||||||
|
{ Idle necessary }
|
||||||
|
EventMask:=EventMask or evIdle;
|
||||||
{$endif TEST_PARTIAL_SYNTAX}
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
LoadFromStream(TS);
|
LoadFromStream(TS);
|
||||||
Dispose(TS, Done);
|
Dispose(TS, Done);
|
||||||
@ -4978,6 +4998,8 @@ begin
|
|||||||
OK:=Assigned(S);
|
OK:=Assigned(S);
|
||||||
{$ifdef TEST_PARTIAL_SYNTAX}
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
||||||
SyntaxComplete:=false;
|
SyntaxComplete:=false;
|
||||||
|
{ Idle necessary }
|
||||||
|
EventMask:=EventMask or evIdle;
|
||||||
{$endif TEST_PARTIAL_SYNTAX}
|
{$endif TEST_PARTIAL_SYNTAX}
|
||||||
if OK then OK:=LoadFromStream(S);
|
if OK then OK:=LoadFromStream(S);
|
||||||
if Assigned(S) then Dispose(S, Done);
|
if Assigned(S) then Dispose(S, Done);
|
||||||
@ -5496,7 +5518,10 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.72 2000-01-07 00:19:30 pierre
|
Revision 1.73 2000-01-10 13:25:46 pierre
|
||||||
|
+ first partial syntax test
|
||||||
|
|
||||||
|
Revision 1.72 2000/01/07 00:19:30 pierre
|
||||||
* forgot CommentLineType check to see if we need to update format
|
* forgot CommentLineType check to see if we need to update format
|
||||||
on next line
|
on next line
|
||||||
* some changes for TEST_PARTIAL_SYNTAX still does notwork :(
|
* some changes for TEST_PARTIAL_SYNTAX still does notwork :(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user