- 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 coorectly load last open project
- enhancement: show caret when show code/header completions
- fix: correctly display pointer info in watch console
- enhancement: search in project
Version 0.2.1
- fix: crash when load last opens

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@
#include "../editorlist.h"
#include "../qsynedit/Search.h"
#include "../qsynedit/SearchRegex.h"
#include "../project.h"
#include <QMessageBox>
#include <QDebug>
@ -68,6 +69,7 @@ void SearchDialog::findInFiles(const QString &text)
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, SynSearchOptions options)
{
mTabBar->setCurrentIndex(1);
ui->cbFind->setCurrentText(keyword);
switch(scope) {
case SearchFileScope::currentFile:
@ -119,7 +121,8 @@ void SearchDialog::onTabChanged()
// Disable project search option when none is open
// 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
// rbOpenFiles.Checked := true;
@ -289,6 +292,38 @@ void SearchDialog::on_btnExecute_clicked()
}
pMainWindow->searchResultModel()->notifySearchResultsUpdated();
} 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
// for I := 0 to MainForm.Project.Units.Count - 1 do begin
// e := MainForm.Project.Units[i].Editor;