fix #46, The generic highlighter is not selected when saving a non D file

This commit is contained in:
Basile Burg 2016-06-15 08:36:21 +02:00
parent 361502ff6a
commit c75de19110
3 changed files with 14 additions and 7 deletions

View File

@ -4356,7 +4356,6 @@ object CEMainForm: TCEMainForm
Images = imgList Images = imgList
OnUpdate = ActionsUpdate OnUpdate = ActionsUpdate
left = 32 left = 32
top = 1
object actEdCopy: TAction object actEdCopy: TAction
Category = 'Edit' Category = 'Edit'
Caption = 'Copy' Caption = 'Copy'

View File

@ -2663,12 +2663,16 @@ begin
end; end;
procedure TCEMainForm.saveProjSource(const aEditor: TCESynMemo); procedure TCEMainForm.saveProjSource(const aEditor: TCESynMemo);
var
fname: string;
begin begin
if fProject = nil then exit; if fProject = nil then exit;
if fProject.filename <> aEditor.fileName then exit; if fProject.filename <> aEditor.fileName then exit;
// //
aEditor.saveToFile(fProject.filename); fname := fProject.filename;
openProj(fProject.filename); fProject.getProject.Free;
aEditor.saveToFile(fname);
openProj(fname);
end; end;
procedure TCEMainForm.closeProj; procedure TCEMainForm.closeProj;
@ -2755,9 +2759,8 @@ end;
procedure TCEMainForm.actProjCloseExecute(Sender: TObject); procedure TCEMainForm.actProjCloseExecute(Sender: TObject);
begin begin
if (fProject <> nil) and not fProject.inGroup and if (fProject <> nil) and not fProject.inGroup and fProject.modified and
fProject.modified and (dlgFileChangeClose(fProject.filename) = mrCancel) then exit;
(dlgFileChangeClose(fProject.filename) = mrCancel) then exit;
closeProj; closeProj;
end; end;
@ -2812,6 +2815,7 @@ begin
if not fProject.filename.fileExists then exit; if not fProject.filename.fileExists then exit;
// //
openFile(fProject.filename); openFile(fProject.filename);
fDoc.isProjectDescription := true;
if fProject.getFormat = pfNative then if fProject.getFormat = pfNative then
fDoc.Highlighter := LfmSyn fDoc.Highlighter := LfmSyn
else else

View File

@ -146,6 +146,7 @@ type
fDetectIndentMode: boolean; fDetectIndentMode: boolean;
fPhobosDocRoot: string; fPhobosDocRoot: string;
fAlwaysAdvancedFeatures: boolean; fAlwaysAdvancedFeatures: boolean;
fIsProjectDescription: boolean;
procedure decCallTipsLvl; procedure decCallTipsLvl;
procedure setMatchOpts(value: TIdentifierMatchOptions); procedure setMatchOpts(value: TIdentifierMatchOptions);
function getMouseFileBytePos: Integer; function getMouseFileBytePos: Integer;
@ -226,6 +227,7 @@ type
property isTemporary: boolean read getIfTemp; property isTemporary: boolean read getIfTemp;
property TextView; property TextView;
// //
property isProjectDescription: boolean read fIsProjectDescription write fIsProjectDescription;
property alwaysAdvancedFeatures: boolean read fAlwaysAdvancedFeatures write fAlwaysAdvancedFeatures; property alwaysAdvancedFeatures: boolean read fAlwaysAdvancedFeatures write fAlwaysAdvancedFeatures;
property phobosDocRoot: string read fPhobosDocRoot write fPhobosDocRoot; property phobosDocRoot: string read fPhobosDocRoot write fPhobosDocRoot;
property detectIndentMode: boolean read fDetectIndentMode write fDetectIndentMode; property detectIndentMode: boolean read fDetectIndentMode write fDetectIndentMode;
@ -1529,7 +1531,9 @@ begin
ext := aFilename.extractFileExt; ext := aFilename.extractFileExt;
fIsDsource := hasDlangSyntax(ext); fIsDsource := hasDlangSyntax(ext);
if fIsDsource then if fIsDsource then
Highlighter := fD2Highlighter; Highlighter := fD2Highlighter
else if not isProjectDescription then
Highlighter := TxtHighlighter;
FileAge(fFilename, fFileDate); FileAge(fFilename, fFileDate);
fModified := false; fModified := false;
if fFilename <> fTempFileName then if fFilename <> fTempFileName then