- fix: crash when load last opens
- enhancement: when a system/project header file is saved to non-system folders, un-readonly the editor - minor speedup when processing tooltips
This commit is contained in:
parent
0424f7cf45
commit
3afe034aa1
3
NEWS.md
3
NEWS.md
|
@ -1,3 +1,6 @@
|
||||||
|
Version 0.2.1
|
||||||
|
- fix: crash when load last opens
|
||||||
|
|
||||||
Version 0.2
|
Version 0.2
|
||||||
- fix : header file completion stop work when input '.'
|
- fix : header file completion stop work when input '.'
|
||||||
- change: continue to run / debug if there are compiling warnings (but no errors)
|
- change: continue to run / debug if there are compiling warnings (but no errors)
|
||||||
|
|
|
@ -376,7 +376,7 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
||||||
foreach(const PProjectUnit& unit, mProject->units()) {
|
foreach(const PProjectUnit& unit, mProject->units()) {
|
||||||
if (getFileType(unit->fileName())!=FileType::WindowsResourceSource)
|
if (getFileType(unit->fileName())!=FileType::WindowsResourceSource)
|
||||||
continue;
|
continue;
|
||||||
if (QFile(unit->fileName()).exists()) {
|
if (fileExists(unit->fileName())) {
|
||||||
QString ResFile = extractRelativePath(mProject->makeFileName(), unit->fileName());
|
QString ResFile = extractRelativePath(mProject->makeFileName(), unit->fileName());
|
||||||
ResFiles = ResFiles + genMakePath2(ResFile) + ' ';
|
ResFiles = ResFiles + genMakePath2(ResFile) + ' ';
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSettings->editor().readOnlySytemHeader()
|
if (pSettings->editor().readOnlySytemHeader()
|
||||||
&& (mParser->isSystemHeaderFile(filename) || mParser->isProjectHeaderFile(filename))) {
|
&& (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) {
|
||||||
this->setModified(false);
|
this->setModified(false);
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
updateCaption();
|
updateCaption();
|
||||||
|
@ -316,6 +316,11 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
if (pSettings->editor().syntaxCheckWhenSave())
|
if (pSettings->editor().syntaxCheckWhenSave())
|
||||||
pMainWindow->checkSyntaxInBack(this);
|
pMainWindow->checkSyntaxInBack(this);
|
||||||
|
|
||||||
|
if (pSettings->editor().readOnlySytemHeader()
|
||||||
|
&& (!mParser->isSystemHeaderFile(mFilename) && !mParser->isProjectHeaderFile(mFilename))) {
|
||||||
|
setReadOnly(false);
|
||||||
|
updateCaption();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,8 +686,8 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
||||||
//selection
|
//selection
|
||||||
if (selAvail() && highlighter()) {
|
if (selAvail() && highlighter()) {
|
||||||
if ((
|
if ((
|
||||||
(attr->name() == SYNS_AttrIdentifier)
|
(attr == highlighter()->identifierAttribute())
|
||||||
|| (attr->name() == SYNS_AttrReservedWord)
|
|| (attr == highlighter()->keywordAttribute())
|
||||||
|| (attr->name() == SYNS_AttrPreprocessor)
|
|| (attr->name() == SYNS_AttrPreprocessor)
|
||||||
)
|
)
|
||||||
&& (token == mSelectionWord)) {
|
&& (token == mSelectionWord)) {
|
||||||
|
@ -694,7 +699,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
||||||
|
|
||||||
|
|
||||||
// qDebug()<<token<<"-"<<attr->name()<<" - "<<line<<" : "<<aChar;
|
// qDebug()<<token<<"-"<<attr->name()<<" - "<<line<<" : "<<aChar;
|
||||||
if (mParser && mCompletionPopup && (attr->name() == SYNS_AttrIdentifier)) {
|
if (mParser && mCompletionPopup && (attr == highlighter()->identifierAttribute())) {
|
||||||
BufferCoord p{aChar,line};
|
BufferCoord p{aChar,line};
|
||||||
BufferCoord pBeginPos,pEndPos;
|
BufferCoord pBeginPos,pEndPos;
|
||||||
QString s= getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpInformation);
|
QString s= getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpInformation);
|
||||||
|
@ -2125,7 +2130,7 @@ Editor::TipType Editor::getTipType(QPoint point, BufferCoord& pos)
|
||||||
// do not allow when dragging selection
|
// do not allow when dragging selection
|
||||||
if (isPointInSelection(pos))
|
if (isPointInSelection(pos))
|
||||||
return TipType::Selection;
|
return TipType::Selection;
|
||||||
} else if (attr->name() == SYNS_AttrIdentifier)
|
} else if (attr == highlighter()->identifierAttribute())
|
||||||
return TipType::Identifier;
|
return TipType::Identifier;
|
||||||
else if (attr->name() == SYNS_AttrPreprocessor)
|
else if (attr->name() == SYNS_AttrPreprocessor)
|
||||||
return TipType::Preprocessor;
|
return TipType::Preprocessor;
|
||||||
|
@ -2388,7 +2393,7 @@ void Editor::updateFunctionTip()
|
||||||
pMainWindow->functionTip()->hide();
|
pMainWindow->functionTip()->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (HLAttr->name()!=SYNS_AttrIdentifier) {
|
if (HLAttr != highlighter()->identifierAttribute()) {
|
||||||
pMainWindow->functionTip()->hide();
|
pMainWindow->functionTip()->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ Editor* EditorList::newEditor(const QString& filename, const QByteArray& encodin
|
||||||
parentPageControl = getNewEditorPageControl();
|
parentPageControl = getNewEditorPageControl();
|
||||||
else
|
else
|
||||||
parentPageControl = page;
|
parentPageControl = page;
|
||||||
if (!filename.isEmpty() && QFile(filename).exists()) {
|
if (fileExists(filename)) {
|
||||||
pMainWindow->fileSystemWatcher()->addPath(filename);
|
pMainWindow->fileSystemWatcher()->addPath(filename);
|
||||||
}
|
}
|
||||||
Editor * e = new Editor(parentPageControl,filename,encoding,inProject,newFile,parentPageControl);
|
Editor * e = new Editor(parentPageControl,filename,encoding,inProject,newFile,parentPageControl);
|
||||||
|
@ -255,6 +255,8 @@ void EditorList::forceCloseEditor(Editor *editor)
|
||||||
|
|
||||||
Editor* EditorList::getOpenedEditorByFilename(const QString &filename)
|
Editor* EditorList::getOpenedEditorByFilename(const QString &filename)
|
||||||
{
|
{
|
||||||
|
if (filename.isEmpty())
|
||||||
|
return nullptr;
|
||||||
QFileInfo fileInfo(filename);
|
QFileInfo fileInfo(filename);
|
||||||
QString fullname = fileInfo.absoluteFilePath();
|
QString fullname = fileInfo.absoluteFilePath();
|
||||||
for (int i=0;i<mLeftPageWidget->count();i++) {
|
for (int i=0;i<mLeftPageWidget->count();i++) {
|
||||||
|
@ -274,6 +276,8 @@ Editor* EditorList::getOpenedEditorByFilename(const QString &filename)
|
||||||
|
|
||||||
Editor *EditorList::getEditorByFilename(const QString &filename)
|
Editor *EditorList::getEditorByFilename(const QString &filename)
|
||||||
{
|
{
|
||||||
|
if (filename.isEmpty())
|
||||||
|
return nullptr;
|
||||||
//check if an editor is already openned
|
//check if an editor is already openned
|
||||||
Editor* e=getOpenedEditorByFilename(filename);
|
Editor* e=getOpenedEditorByFilename(filename);
|
||||||
if (e!=nullptr)
|
if (e!=nullptr)
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ void MainWindow::loadLastOpens()
|
||||||
updateEditorActions();
|
updateEditorActions();
|
||||||
updateForEncodingInfo();
|
updateForEncodingInfo();
|
||||||
}
|
}
|
||||||
if (!focusedEditor)
|
if (focusedEditor)
|
||||||
focusedEditor->activate();
|
focusedEditor->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,8 @@ QString getSystemHeaderFilename(const QString &fileName, const QSet<QString>& in
|
||||||
|
|
||||||
bool isSystemHeaderFile(const QString &fileName, const QSet<QString> &includePaths)
|
bool isSystemHeaderFile(const QString &fileName, const QSet<QString> &includePaths)
|
||||||
{
|
{
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
return false;
|
||||||
if (includePaths.isEmpty())
|
if (includePaths.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
bool isFullName = false;
|
bool isFullName = false;
|
||||||
|
|
|
@ -135,6 +135,8 @@ bool isNonPrintableAsciiChar(char ch)
|
||||||
|
|
||||||
bool fileExists(const QString &file)
|
bool fileExists(const QString &file)
|
||||||
{
|
{
|
||||||
|
if (file.isEmpty())
|
||||||
|
return false;
|
||||||
return QFile(file).exists();
|
return QFile(file).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +150,8 @@ bool fileExists(const QString &dir, const QString &fileName)
|
||||||
|
|
||||||
bool directoryExists(const QString &file)
|
bool directoryExists(const QString &file)
|
||||||
{
|
{
|
||||||
|
if (file.isEmpty())
|
||||||
|
return false;
|
||||||
QFileInfo dir(file);
|
QFileInfo dir(file);
|
||||||
return dir.exists() && dir.isDir();
|
return dir.exists() && dir.isDir();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue