- enhancement: Auto close other search/replace dialogs when start to search/replace.
- change: Remove "prompt when replace" in the replace. - fix: Search/replace with regex is not correctly handled.
This commit is contained in:
parent
12983f5ae0
commit
511b6c679b
5
NEWS.md
5
NEWS.md
|
@ -3,11 +3,14 @@ Red Panda C++ Version 2.15
|
||||||
- fix: Static class members is not correctly recognized as static.
|
- fix: Static class members is not correctly recognized as static.
|
||||||
- fix: Function with reference type return value is not correctly parsed.
|
- fix: Function with reference type return value is not correctly parsed.
|
||||||
- enhancement: Add descriptions for x86 registers in the cpu info dialog.
|
- enhancement: Add descriptions for x86 registers in the cpu info dialog.
|
||||||
- fix: Search dialog shouldn't have "confirm when replace".
|
- fix: Search dialog shouldn't have "prompt when replace".
|
||||||
- change: Default value for the debugger debugger panel "memory view's columns" is changed from 8 to 16.
|
- change: Default value for the debugger debugger panel "memory view's columns" is changed from 8 to 16.
|
||||||
- change: Default value for the debugger debugger panel "memory view's rows" is changed from 8 to 16.
|
- change: Default value for the debugger debugger panel "memory view's rows" is changed from 8 to 16.
|
||||||
- enhancement: Display hex value as ascii chars in the debugger panel memory view tab.
|
- enhancement: Display hex value as ascii chars in the debugger panel memory view tab.
|
||||||
- fix: Word on the last line's end can't be searched.
|
- fix: Word on the last line's end can't be searched.
|
||||||
|
- enhancement: Auto close other search/replace dialogs when start to search/replace.
|
||||||
|
- change: Remove "prompt when replace" in the replace.
|
||||||
|
- fix: Search/replace with regex is not correctly handled.
|
||||||
|
|
||||||
Red Panda C++ Version 2.14
|
Red Panda C++ Version 2.14
|
||||||
|
|
||||||
|
|
|
@ -1058,6 +1058,16 @@ int MainWindow::calIconSize(const QString &fontName, int fontPointSize)
|
||||||
return metrics.ascent();
|
return metrics.ascent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::hideAllSearchDialogs()
|
||||||
|
{
|
||||||
|
if (mReplaceDialog)
|
||||||
|
mReplaceDialog->hide();
|
||||||
|
if (mSearchDialog)
|
||||||
|
mSearchDialog->hide();
|
||||||
|
if (mSearchInFilesDialog)
|
||||||
|
mSearchInFilesDialog->hide();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::prepareSearchDialog()
|
void MainWindow::prepareSearchDialog()
|
||||||
{
|
{
|
||||||
if (!mSearchDialog)
|
if (!mSearchDialog)
|
||||||
|
@ -1070,6 +1080,13 @@ void MainWindow::prepareReplaceDialog()
|
||||||
mReplaceDialog = new ReplaceDialog(this);
|
mReplaceDialog = new ReplaceDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::prepareSearchInFilesDialog()
|
||||||
|
{
|
||||||
|
if (mSearchInFilesDialog==nullptr) {
|
||||||
|
mSearchInFilesDialog = new SearchInFileDialog(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateAppTitle()
|
void MainWindow::updateAppTitle()
|
||||||
{
|
{
|
||||||
Editor *e = mEditorList->getEditor();
|
Editor *e = mEditorList->getEditor();
|
||||||
|
@ -6270,15 +6287,15 @@ void MainWindow::on_actionFind_triggered()
|
||||||
if (!e)
|
if (!e)
|
||||||
return;
|
return;
|
||||||
QString s = e->wordAtCursor();
|
QString s = e->wordAtCursor();
|
||||||
|
hideAllSearchDialogs();
|
||||||
prepareSearchDialog();
|
prepareSearchDialog();
|
||||||
mSearchDialog->find(s);
|
mSearchDialog->find(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFind_in_files_triggered()
|
void MainWindow::on_actionFind_in_files_triggered()
|
||||||
{
|
{
|
||||||
if (mSearchInFilesDialog==nullptr) {
|
hideAllSearchDialogs();
|
||||||
mSearchInFilesDialog = new SearchInFileDialog(this);
|
prepareSearchInFilesDialog();
|
||||||
}
|
|
||||||
Editor *e = mEditorList->getEditor();
|
Editor *e = mEditorList->getEditor();
|
||||||
if (e) {
|
if (e) {
|
||||||
QString s = e->wordAtCursor();
|
QString s = e->wordAtCursor();
|
||||||
|
@ -6295,6 +6312,7 @@ void MainWindow::on_actionReplace_triggered()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString s = e->wordAtCursor();
|
QString s = e->wordAtCursor();
|
||||||
|
hideAllSearchDialogs();
|
||||||
prepareReplaceDialog();
|
prepareReplaceDialog();
|
||||||
mReplaceDialog->replace(s);
|
mReplaceDialog->replace(s);
|
||||||
}
|
}
|
||||||
|
@ -6341,9 +6359,7 @@ void MainWindow::on_cbSearchHistory_currentIndexChanged(int index)
|
||||||
|
|
||||||
void MainWindow::on_btnSearchAgain_clicked()
|
void MainWindow::on_btnSearchAgain_clicked()
|
||||||
{
|
{
|
||||||
if (mSearchInFilesDialog==nullptr) {
|
hideAllSearchDialogs();
|
||||||
mSearchInFilesDialog = new SearchInFileDialog(this);
|
|
||||||
}
|
|
||||||
PSearchResults results=mSearchResultModel.currentResults();
|
PSearchResults results=mSearchResultModel.currentResults();
|
||||||
if (!results)
|
if (!results)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -274,8 +274,10 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int calIconSize(const QString &fontName, int fontPointSize);
|
int calIconSize(const QString &fontName, int fontPointSize);
|
||||||
|
void hideAllSearchDialogs();
|
||||||
void prepareSearchDialog();
|
void prepareSearchDialog();
|
||||||
void prepareReplaceDialog();
|
void prepareReplaceDialog();
|
||||||
|
void prepareSearchInFilesDialog();
|
||||||
void prepareProjectForCompile();
|
void prepareProjectForCompile();
|
||||||
void closeProject(bool refreshEditor);
|
void closeProject(bool refreshEditor);
|
||||||
void updateProjectView();
|
void updateProjectView();
|
||||||
|
|
|
@ -965,7 +965,6 @@
|
||||||
<widget class="IssuesTable" name="tableIssues">
|
<widget class="IssuesTable" name="tableIssues">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>512</width>
|
<width>512</width>
|
||||||
<height>242</height>
|
<height>308</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -196,12 +196,18 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>7</number>
|
<number>7</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="chkWholeWord">
|
<spacer name="verticalSpacer_4">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>Whole words only</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="chkWrapAround">
|
<widget class="QCheckBox" name="chkWrapAround">
|
||||||
|
@ -213,6 +219,26 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkCaseSensetive">
|
||||||
|
<property name="text">
|
||||||
|
<string>Case Sensitive</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkRegExp">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Regular Expression</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="txtRegExpHelp">
|
<widget class="QLabel" name="txtRegExpHelp">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -229,49 +255,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="chkRegExp">
|
<widget class="QCheckBox" name="chkWholeWord">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Regular Expression</string>
|
<string>Whole words only</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkPrompt">
|
|
||||||
<property name="text">
|
|
||||||
<string>Prompt on replace</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkCaseSensetive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Case Sensitive</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<spacer name="verticalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -5121,10 +5121,10 @@ int QSynEdit::searchReplace(const QString &sSearch, const QString &sReplace, Sea
|
||||||
ptCurrent = ptStart;
|
ptCurrent = ptStart;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ptStart.ch = 1;
|
ptStart.ch = 0;
|
||||||
ptStart.line = 1;
|
ptStart.line = 1;
|
||||||
ptEnd.line = mDocument->count();
|
ptEnd.line = mDocument->count();
|
||||||
ptEnd.ch = mDocument->getLine(ptEnd.line - 1).length();
|
ptEnd.ch = mDocument->getLine(ptEnd.line - 1).length()+1;
|
||||||
if (bFromCursor) {
|
if (bFromCursor) {
|
||||||
if (bBackward)
|
if (bBackward)
|
||||||
ptEnd = caretXY();
|
ptEnd = caretXY();
|
||||||
|
@ -5173,12 +5173,19 @@ int QSynEdit::searchReplace(const QString &sSearch, const QString &sReplace, Sea
|
||||||
// Is the search result entirely in the search range?
|
// Is the search result entirely in the search range?
|
||||||
bool isInValidSearchRange = true;
|
bool isInValidSearchRange = true;
|
||||||
int first = nFound;
|
int first = nFound;
|
||||||
int last = nFound + nSearchLen -1;
|
int last = nFound + nSearchLen;
|
||||||
if ((mActiveSelectionMode == SelectionMode::Normal)
|
if ((mActiveSelectionMode == SelectionMode::Normal)
|
||||||
|| !sOptions.testFlag(ssoSelectedOnly)) {
|
|| !sOptions.testFlag(ssoSelectedOnly)) {
|
||||||
if (((ptCurrent.line == ptStart.line) && (first < ptStart.ch)) ||
|
// qDebug()<<ptStart.line<<ptStart.ch<<ptEnd.line<<ptEnd.ch<<ptCurrent.line<<first<<last;
|
||||||
((ptCurrent.line == ptEnd.line) && (last > ptEnd.ch)))
|
if ((nSearchLen==0) &&
|
||||||
|
(((ptCurrent.line == ptStart.line) && (first == ptStart.ch) && !bBackward)
|
||||||
|
|| ((ptCurrent.line == ptEnd.line) && (last == ptEnd.ch) && bBackward))
|
||||||
|
) {
|
||||||
isInValidSearchRange = false;
|
isInValidSearchRange = false;
|
||||||
|
} else if (((ptCurrent.line == ptStart.line) && (first < ptStart.ch)) ||
|
||||||
|
((ptCurrent.line == ptEnd.line) && (last > ptEnd.ch))) {
|
||||||
|
isInValidSearchRange = false;
|
||||||
|
}
|
||||||
} else if (mActiveSelectionMode == SelectionMode::Column) {
|
} else if (mActiveSelectionMode == SelectionMode::Column) {
|
||||||
// solves bug in search/replace when smColumn mode active and no selection
|
// solves bug in search/replace when smColumn mode active and no selection
|
||||||
isInValidSearchRange = ((first >= ptStart.ch) && (last <= ptEnd.ch))
|
isInValidSearchRange = ((first >= ptStart.ch) && (last <= ptEnd.ch))
|
||||||
|
@ -5249,15 +5256,17 @@ int QSynEdit::searchReplace(const QString &sSearch, const QString &sReplace, Sea
|
||||||
break;
|
break;
|
||||||
//search start from cursor, search has finished but no result founds
|
//search start from cursor, search has finished but no result founds
|
||||||
bFromCursor = false;
|
bFromCursor = false;
|
||||||
ptStart.ch = 1;
|
ptStart.ch = 0;
|
||||||
ptStart.line = 1;
|
ptStart.line = 1;
|
||||||
ptEnd.line = mDocument->count();
|
ptEnd.line = mDocument->count();
|
||||||
ptEnd.ch = mDocument->getLine(ptEnd.line - 1).length();
|
ptEnd.ch = mDocument->getLine(ptEnd.line - 1).length()+1;
|
||||||
if (bBackward) {
|
if (bBackward) {
|
||||||
ptStart = originCaretXY;
|
ptStart = originCaretXY;
|
||||||
|
ptEnd.ch++;
|
||||||
ptCurrent = ptEnd;
|
ptCurrent = ptEnd;
|
||||||
} else {
|
} else {
|
||||||
ptEnd= originCaretXY;
|
ptEnd= originCaretXY;
|
||||||
|
ptStart.ch--;
|
||||||
ptCurrent = ptStart;
|
ptCurrent = ptStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,6 @@ int RegexSearcher::findAll(const QString &text)
|
||||||
QRegularExpressionMatchIterator it = mRegex.globalMatch(text);
|
QRegularExpressionMatchIterator it = mRegex.globalMatch(text);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QRegularExpressionMatch match = it.next();
|
QRegularExpressionMatch match = it.next();
|
||||||
if (match.capturedLength()==0)
|
|
||||||
continue;
|
|
||||||
mLengths.append(match.capturedLength());
|
mLengths.append(match.capturedLength());
|
||||||
mResults.append(match.capturedStart());
|
mResults.append(match.capturedStart());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue