- enhancement: show caret when show code/header completions

- fix: correctly display pointer info in watch console
 - enhancement: search in project
This commit is contained in:
royqh1979 2021-09-29 20:45:03 +08:00
parent 0940777f15
commit fbdba624be
9 changed files with 66 additions and 11 deletions

View File

@ -11,6 +11,8 @@ Version 0.2.2
- fix: can't correctly load last open files / project with non-asii characters in path - fix: can't correctly load last open files / project with non-asii characters in path
- fix: can't coorectly load last open project - fix: can't coorectly load last open project
- enhancement: show caret when show code/header completions - enhancement: show caret when show code/header completions
- fix: correctly display pointer info in watch console
- enhancement: search in project
Version 0.2.1 Version 0.2.1
- fix: crash when load last opens - fix: crash when load last opens

View File

@ -1281,7 +1281,9 @@ void DebugReader::processWatchOutput(PWatchVar watchVar)
varStack.push_back(parentVar); varStack.push_back(parentVar);
parentVar = newVar; parentVar = newVar;
} }
currentVar = nullptr;
} else if (ch == '}') { } else if (ch == '}') {
currentVar = nullptr;
PWatchVar newVar = std::make_shared<WatchVar>(); PWatchVar newVar = std::make_shared<WatchVar>();
newVar->parent = parentVar.get(); newVar->parent = parentVar.get();
newVar->name = ""; newVar->name = "";
@ -1295,11 +1297,14 @@ void DebugReader::processWatchOutput(PWatchVar watchVar)
} else if (ch == '=') { } else if (ch == '=') {
// just skip it // just skip it
} else if (ch == ',') { } else if (ch == ',') {
currentVar = nullptr;
} else { } else {
if (currentVar) { if (currentVar) {
currentVar->value = token; if (currentVar->value.isEmpty()) {
currentVar = nullptr; currentVar->value = token;
} else {
currentVar->value += " "+token;
}
} else { } else {
PWatchVar newVar = std::make_shared<WatchVar>(); PWatchVar newVar = std::make_shared<WatchVar>();
newVar->parent = parentVar.get(); newVar->parent = parentVar.get();
@ -1502,6 +1507,18 @@ QStringList DebugReader::tokenize(const QString &s)
} }
tEnd = std::min(i,s.length()); tEnd = std::min(i,s.length());
result.append(s.mid(tStart,tEnd-tStart)); result.append(s.mid(tStart,tEnd-tStart));
} else if (ch == '(') {
tStart = i;
i++;
while (i<s.length()) {
if (s[i]==')') {
i++;
break;
}
i++;
}
tEnd = std::min(i,s.length());
result.append(s.mid(tStart,tEnd-tStart));
} else if (ch == '_' || } else if (ch == '_' ||
ch == '.' || ch == '.' ||
ch == '+' || ch == '+' ||

View File

@ -2615,7 +2615,7 @@ QString getWordAtPosition(SynEdit *editor, const BufferCoord &p, BufferCoord &pW
if (!findComplement(s, ']', '[', wordBegin, -1)) if (!findComplement(s, ']', '[', wordBegin, -1))
break; break;
else else
wordBegin++; // step over mathing [ wordBegin--; // step over mathing [
} else if (editor->isIdentChar(s[wordBegin])) { } else if (editor->isIdentChar(s[wordBegin])) {
wordBegin--; wordBegin--;
} else if (s[wordBegin] == '.' } else if (s[wordBegin] == '.'

View File

@ -288,7 +288,7 @@
<enum>QTabWidget::South</enum> <enum>QTabWidget::South</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tabIssues"> <widget class="QWidget" name="tabIssues">
<attribute name="icon"> <attribute name="icon">

View File

@ -226,7 +226,5 @@ void ProjectFilesWidget::on_cbEncodingDetail_currentTextChanged(const QString &a
if(!unit) if(!unit)
return; return;
unit->setEncoding(ui->cbEncodingDetail->currentText().toLocal8Bit()); unit->setEncoding(ui->cbEncodingDetail->currentText().toLocal8Bit());
ui->cbEncodingDetail->setVisible(false);
ui->cbEncodingDetail->clear();
} }

View File

@ -136,7 +136,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="cbEncodingDetail"/> <widget class="QComboBox" name="cbEncodingDetail">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">

View File

@ -451,7 +451,7 @@ void changeTheme(const QString &themeName)
if (!f.exists()) { if (!f.exists()) {
qDebug()<<"Unable to set stylesheet, file not found\n"; qDebug()<<"Unable to set stylesheet, file not found\n";
} else { } else {
QApplication::setStyle("fusion"); QApplication::setStyle("Windowsvista");
f.open(QFile::ReadOnly | QFile::Text); f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f); QTextStream ts(&f);
dynamic_cast<QApplication*>(QApplication::instance())->setStyleSheet(ts.readAll()); dynamic_cast<QApplication*>(QApplication::instance())->setStyleSheet(ts.readAll());

View File

@ -24,7 +24,6 @@ void CodeCompletionListView::focusInEvent(QFocusEvent *event)
{ {
Editor *editor = pMainWindow->editorList()->getEditor(); Editor *editor = pMainWindow->editorList()->getEditor();
if (editor) { if (editor) {
qDebug()<<"popup:show caret";
editor->showCaret(); editor->showCaret();
} }
} }

View File

@ -6,6 +6,7 @@
#include "../editorlist.h" #include "../editorlist.h"
#include "../qsynedit/Search.h" #include "../qsynedit/Search.h"
#include "../qsynedit/SearchRegex.h" #include "../qsynedit/SearchRegex.h"
#include "../project.h"
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
@ -68,6 +69,7 @@ void SearchDialog::findInFiles(const QString &text)
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, SynSearchOptions options) void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, SynSearchOptions options)
{ {
mTabBar->setCurrentIndex(1); mTabBar->setCurrentIndex(1);
ui->cbFind->setCurrentText(keyword); ui->cbFind->setCurrentText(keyword);
switch(scope) { switch(scope) {
case SearchFileScope::currentFile: case SearchFileScope::currentFile:
@ -119,7 +121,8 @@ void SearchDialog::onTabChanged()
// Disable project search option when none is open // Disable project search option when none is open
// rbProjectFiles.Enabled := Assigned(MainForm.Project); // rbProjectFiles.Enabled := Assigned(MainForm.Project);
ui->rbProject->setEnabled(false); ui->rbProject->setEnabled(pMainWindow->project()!=nullptr);
ui->rbOpenFiles->setEnabled(pMainWindow->editorList()->pageCount()>0);
// if not Assigned(MainForm.Project) then // if not Assigned(MainForm.Project) then
// rbOpenFiles.Checked := true; // rbOpenFiles.Checked := true;
@ -289,6 +292,38 @@ void SearchDialog::on_btnExecute_clicked()
} }
pMainWindow->searchResultModel()->notifySearchResultsUpdated(); pMainWindow->searchResultModel()->notifySearchResultsUpdated();
} else if (ui->rbProject->isChecked()) { } else if (ui->rbProject->isChecked()) {
PSearchResults results = pMainWindow->searchResultModel()->addSearchResults(
keyword,
mSearchOptions,
SearchFileScope::wholeProject
);
for (int i=0;i<pMainWindow->project()->units().count();i++) {
Editor * e = pMainWindow->project()->units()[i]->editor();
QString curFilename = pMainWindow->project()->units()[i]->fileName();
if (e) {
fileSearched++;
PSearchResultTreeItem parentItem = batchFindInEditor(e,
keyword);
int t = parentItem->results.size();
findCount+=t;
if (t>0) {
fileHitted++;
results->results.append(parentItem);
}
} else if (fileExists(curFilename)) {
Editor editor(nullptr,curFilename,ENCODING_AUTO_DETECT,false,false,nullptr);
fileSearched++;
PSearchResultTreeItem parentItem = batchFindInEditor(&editor,
keyword);
int t = parentItem->results.size();
findCount+=t;
if (t>0) {
fileHitted++;
results->results.append(parentItem);
}
}
}
// end else if rbProjectFiles.Checked then begin // end else if rbProjectFiles.Checked then begin
// for I := 0 to MainForm.Project.Units.Count - 1 do begin // for I := 0 to MainForm.Project.Units.Count - 1 do begin
// e := MainForm.Project.Units[i].Editor; // e := MainForm.Project.Units[i].Editor;