- fix: can't show code completion popup if symbol is proceed with an operator '~' ( and it's not a destructor)

- fix: can't show code completion popup when define MACRO
 - fix: can't debug files with chinese characters in the path
This commit is contained in:
royqh1979@gmail.com 2021-11-10 21:28:08 +08:00
parent ad7fb23117
commit 3d2fb53388
6 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,9 @@
Version 0.8.4 For Dev-C++ 7 Beta Version 0.8.4 For Dev-C++ 7 Beta
- enhancement: auto save/load the default open folder in the configuration file - enhancement: auto save/load the default open folder in the configuration file
- fix: shouldn't auto add '()' when char succeeding the completed function name is '(' - fix: shouldn't auto add '()' when char succeeding the completed function name is '('
- fix: can't show code completion popup if symbol is proceed with an operator '~' ( and it's not a destructor)
- fix: can't show code completion popup when define MACRO
- fix: can't debug files with chinese characters in the path
Version 0.8.3 For Dev-C++ 7 Beta Version 0.8.3 For Dev-C++ 7 Beta
- enhancement: View menu - enhancement: View menu

View File

@ -1450,9 +1450,9 @@ void DebugReader::runNextCmd()
emit cmdStarted(); emit cmdStarted();
QByteArray s; QByteArray s;
s=pCmd->command.toUtf8(); s=pCmd->command.toLocal8Bit();
if (!pCmd->params.isEmpty()) { if (!pCmd->params.isEmpty()) {
s+=' '+pCmd->params.toUtf8(); s+= ' '+pCmd->params.toLocal8Bit();
} }
s+= "\n"; s+= "\n";
if (mProcess->write(s)<0) { if (mProcess->write(s)<0) {
@ -1681,7 +1681,7 @@ void DebugReader::run()
readed = mProcess->readAll(); readed = mProcess->readAll();
buffer += readed; buffer += readed;
if (getLastAnnotation(buffer) == AnnotationType::TPrompt) { if (getLastAnnotation(buffer) == AnnotationType::TPrompt) {
mOutput = QString::fromUtf8(buffer); mOutput = QString::fromLocal8Bit(buffer);
processDebugOutput(); processDebugOutput();
buffer.clear(); buffer.clear();
mCmdRunning = false; mCmdRunning = false;

View File

@ -2279,8 +2279,7 @@ void Editor::showCompletion(bool autoComplete)
if (tokenType == SynHighlighterTokenType::PreprocessDirective) {//Preprocessor if (tokenType == SynHighlighterTokenType::PreprocessDirective) {//Preprocessor
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpDirective); word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpDirective);
if (!word.startsWith('#')) { if (!word.startsWith('#')) {
//showTabnineCompletion(); word = "";
return;
} }
} else if (tokenType == SynHighlighterTokenType::Comment) { //Comment, javadoc tag } else if (tokenType == SynHighlighterTokenType::Comment) { //Comment, javadoc tag
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpJavadoc); word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpJavadoc);

View File

@ -1296,7 +1296,6 @@ void MainWindow::debug()
if (!mDebugger->start()) if (!mDebugger->start())
return; return;
filePath.replace('\\','/'); filePath.replace('\\','/');
mDebugger->sendCommand("set","host charset UTF-8");
mDebugger->sendCommand("file", '"' + filePath + '"'); mDebugger->sendCommand("file", '"' + filePath + '"');
if (mProject->options().type == ProjectType::DynamicLib) { if (mProject->options().type == ProjectType::DynamicLib) {

View File

@ -85,7 +85,7 @@
<enum>QTabWidget::West</enum> <enum>QTabWidget::West</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<property name="usesScrollButtons"> <property name="usesScrollButtons">
<bool>true</bool> <bool>true</bool>
@ -171,10 +171,10 @@
<enum>Qt::ElideNone</enum> <enum>Qt::ElideNone</enum>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool> <bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>50</number>
</attribute> </attribute>
</widget> </widget>
</item> </item>

View File

@ -72,6 +72,11 @@ void CodeCompletionPopup::prepareSearch(const QString &phrase, const QString &fi
mIncludedFiles = mParser->getFileIncludes(filename); mIncludedFiles = mParser->getFileIncludes(filename);
getCompletionFor(filename,phrase,line); getCompletionFor(filename,phrase,line);
if (mFullCompletionStatementList.isEmpty() && phrase.startsWith('~')) {
mPhrase = phrase.mid(1);
getCompletionFor(filename,mPhrase,line);
}
//todo: notify model //todo: notify model
//CodeComplForm.lbCompletion.Font.Size := FontSize; //CodeComplForm.lbCompletion.Font.Size := FontSize;
//CodeComplForm.lbCompletion.ItemHeight := CodeComplForm.lbCompletion.Canvas.TextHeight('F')+6; //CodeComplForm.lbCompletion.ItemHeight := CodeComplForm.lbCompletion.Canvas.TextHeight('F')+6;
@ -110,6 +115,13 @@ bool CodeCompletionPopup::search(const QString &phrase, bool autoHideOnSingleRes
QString symbol = phrase.mid(i); QString symbol = phrase.mid(i);
// filter fFullCompletionStatementList to fCompletionStatementList // filter fFullCompletionStatementList to fCompletionStatementList
filterList(symbol); filterList(symbol);
//if can't find a destructor, maybe '~' is only an operator
if (mCompletionStatementList.isEmpty() && phrase.startsWith('~')) {
symbol = phrase.mid(1);
filterList(symbol);
}
mModel->notifyUpdated(); mModel->notifyUpdated();
setCursor(oldCursor); setCursor(oldCursor);