mirror of https://gitlab.com/basile.b/dexed.git
dont detect module name after line 50
This commit is contained in:
parent
61e0925b22
commit
605a24c1ff
|
@ -59,7 +59,6 @@ type
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
fProj: ICECommonProject;
|
fProj: ICECommonProject;
|
||||||
fTokList: TLexTokenList;
|
fTokList: TLexTokenList;
|
||||||
fErrList: TLexErrorList;
|
|
||||||
fModStart: boolean;
|
fModStart: boolean;
|
||||||
fLastCommand: TSynEditorCommand;
|
fLastCommand: TSynEditorCommand;
|
||||||
procedure pageBtnAddCLick(Sender: TObject);
|
procedure pageBtnAddCLick(Sender: TObject);
|
||||||
|
@ -127,7 +126,6 @@ begin
|
||||||
AssignPng(pageControl.splitButton, 'splitter');
|
AssignPng(pageControl.splitButton, 'splitter');
|
||||||
|
|
||||||
fTokList := TLexTokenList.Create;
|
fTokList := TLexTokenList.Create;
|
||||||
fErrList := TLexErrorList.Create;
|
|
||||||
//
|
//
|
||||||
AssignPng(mnuedCopy.Bitmap, 'copy');
|
AssignPng(mnuedCopy.Bitmap, 'copy');
|
||||||
AssignPng(mnuedCut.Bitmap, 'cut');
|
AssignPng(mnuedCut.Bitmap, 'cut');
|
||||||
|
@ -153,7 +151,6 @@ begin
|
||||||
if (PageControl.Pages[i].Controls[0] is TCESynMemo) then
|
if (PageControl.Pages[i].Controls[0] is TCESynMemo) then
|
||||||
PageControl.Pages[i].Controls[0].Free;
|
PageControl.Pages[i].Controls[0].Free;
|
||||||
fTokList.Free;
|
fTokList.Free;
|
||||||
fErrList.Free;
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -501,15 +498,14 @@ begin
|
||||||
end else
|
end else
|
||||||
editorStatus.Panels[3].Width:= 0;
|
editorStatus.Panels[3].Width:= 0;
|
||||||
editorStatus.Panels[4].Text := fDoc.fileName;
|
editorStatus.Panels[4].Text := fDoc.fileName;
|
||||||
if Visible and (pageControl.currentPage <> nil) and ((pageControl.currentPage.Caption = '') or
|
if Visible and pageControl.currentPage.isNotNil and ((pageControl.currentPage.Caption = '') or
|
||||||
(pageControl.currentPage.Caption = '<new document>')) then
|
(pageControl.currentPage.Caption = '<new document>')) then
|
||||||
begin
|
begin
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource and (fDoc.CaretY < 50) then
|
||||||
begin
|
begin
|
||||||
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
||||||
md := getModuleName(fTokList);
|
md := getModuleName(fTokList);
|
||||||
fTokList.Clear;
|
fTokList.Clear;
|
||||||
fErrList.Clear;
|
|
||||||
end;
|
end;
|
||||||
if md.isEmpty then md := fDoc.fileName.extractFileName;
|
if md.isEmpty then md := fDoc.fileName.extractFileName;
|
||||||
pageControl.currentPage.Caption := md;
|
pageControl.currentPage.Caption := md;
|
||||||
|
@ -519,14 +515,16 @@ end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.lexFindToken(const aToken: PLexToken; out doStop: boolean);
|
procedure TCEEditorWidget.lexFindToken(const aToken: PLexToken; out doStop: boolean);
|
||||||
begin
|
begin
|
||||||
if aToken^.kind = ltkKeyword then
|
if (aToken^.kind = ltkKeyword) and (aToken^.data = 'module') then
|
||||||
if aToken^.data = 'module' then
|
begin
|
||||||
fModStart := true;
|
fModStart := true;
|
||||||
if fModStart then if aToken^.kind = ltkSymbol then
|
exit;
|
||||||
if aToken^.data = ';' then begin
|
end;
|
||||||
doStop := true;
|
if fModStart and (aToken^.kind = ltkSymbol) and (aToken^.data = ';') then
|
||||||
fModStart := false;
|
begin
|
||||||
end;
|
doStop := true;
|
||||||
|
fModStart := false;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.updateDelayed;
|
procedure TCEEditorWidget.updateDelayed;
|
||||||
|
@ -541,15 +539,13 @@ begin
|
||||||
if fDoc.Lines.Count = 0 then exit;
|
if fDoc.Lines.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
md := '';
|
md := '';
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource and (fDoc.CaretY < 50) then
|
||||||
begin
|
begin
|
||||||
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
||||||
md := getModuleName(fTokList);
|
md := getModuleName(fTokList);
|
||||||
fTokList.Clear;
|
fTokList.Clear;
|
||||||
fErrList.Clear;
|
|
||||||
end;
|
end;
|
||||||
if md.isEmpty then
|
if md.isEmpty then md := fDoc.fileName.extractFileName;
|
||||||
md := fDoc.fileName.extractFileName;
|
|
||||||
pageControl.currentPage.Caption := md;
|
pageControl.currentPage.Caption := md;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
Loading…
Reference in New Issue