- fix: search around option can't be disabled
- enhancement: show a confirm dialog when search/replace around
This commit is contained in:
parent
c100c5c3e8
commit
1135fcf7dd
2
NEWS.md
2
NEWS.md
|
@ -22,6 +22,8 @@ Red Panda C++ Version 0.13.3
|
|||
- fix: indent lines displayed at wrong position, when there are folded lines
|
||||
- fix: if editor's active line color is disabled, caret's position may not be correct redrawn
|
||||
- fix: insert code snippets will crash, if current compiler set's include dir list is not empty and lib dir list is empty
|
||||
- fix: search around option can't be disabled
|
||||
- enhancement: show a confirm dialog when search/replace around
|
||||
|
||||
Red Panda C++ Version 0.13.2
|
||||
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly
|
||||
|
|
Binary file not shown.
|
@ -773,9 +773,8 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>链接时加入下列选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.ui" line="141"/>
|
||||
<source>Add Charset arguments when calling the compiler</source>
|
||||
<translation>编译时自动加入字符编码选项</translation>
|
||||
<translation type="vanished">编译时自动加入字符编码选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.ui" line="35"/>
|
||||
|
@ -807,6 +806,12 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Remove</source>
|
||||
<translation>删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.ui" line="141"/>
|
||||
<source>Convert Executable's Charset as</source>
|
||||
<oldsource>Convert Executable's Charset</oldsource>
|
||||
<translation>将可执行文件中的字符串转码为</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.ui" line="157"/>
|
||||
<source>Statically link libraries</source>
|
||||
|
@ -902,12 +907,12 @@ p, li { white-space: pre-wrap; }
|
|||
<translation>选择性能分析器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="285"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="283"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="277"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="275"/>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue?</source>
|
||||
<oldsource>Red Panda C++ will clear current compiler list and search for compilers in the following locations:
|
||||
'%1'
|
||||
|
@ -916,50 +921,50 @@ Are you really want to continue?</oldsource>
|
|||
<translation>小熊猫C++ 将会清除现有的编译器配置列表,然后在下列文件夹中搜索编译器:<br/> '%1'<br/> '%2'<br />你确定要继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="65"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="64"/>
|
||||
<source>ANSI</source>
|
||||
<translation>ANSI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="66"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="65"/>
|
||||
<source>UTF-8</source>
|
||||
<translation>UTF-8</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="282"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="280"/>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue?</source>
|
||||
<translation>小熊猫C++ 将会清除现有的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="293"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="317"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="291"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="315"/>
|
||||
<source>Failed</source>
|
||||
<translation>失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="293"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="317"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="291"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="315"/>
|
||||
<source>Can't find any compiler.</source>
|
||||
<translation>找不到编译器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="299"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="323"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="297"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="321"/>
|
||||
<source>Compiler Set Name</source>
|
||||
<translation>编译器配置名称</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="299"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="297"/>
|
||||
<source>Name</source>
|
||||
<translation>名称</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="308"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="306"/>
|
||||
<source>Compiler Set Folder</source>
|
||||
<translation>编译器所在文件夹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="323"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="321"/>
|
||||
<source>New name</source>
|
||||
<translation>新名称</translation>
|
||||
</message>
|
||||
|
@ -6027,6 +6032,26 @@ Are you really want to continue?</oldsource>
|
|||
<source>Cannot find the %1 "%2"</source>
|
||||
<translation>无法找到%1程序"%2"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="1594"/>
|
||||
<source>C Compiler</source>
|
||||
<translation>C编译器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="1599"/>
|
||||
<source>C++ Compiler</source>
|
||||
<translation>C++编译器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="1604"/>
|
||||
<source>Maker</source>
|
||||
<translation>构建程序(Make)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="1609"/>
|
||||
<source>Debugger</source>
|
||||
<translation>调试器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2137"/>
|
||||
<source>C options</source>
|
||||
|
@ -6093,7 +6118,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>生成调试信息(-g3)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2631"/>
|
||||
<location filename="settings.cpp" line="2636"/>
|
||||
<source>Would you like Red Panda C++ to search for compilers in PATH?</source>
|
||||
<translation>您同意小熊猫C++在PATH路径中寻找gcc编译器吗?</translation>
|
||||
</message>
|
||||
|
@ -6192,34 +6217,34 @@ Are you really want to continue?</oldsource>
|
|||
<translation>只生成汇编代码(-S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2592"/>
|
||||
<location filename="settings.cpp" line="2633"/>
|
||||
<location filename="settings.cpp" line="2597"/>
|
||||
<location filename="settings.cpp" line="2638"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2593"/>
|
||||
<location filename="settings.cpp" line="2598"/>
|
||||
<source>The following problems were found during validation of compiler set "%1":</source>
|
||||
<translation>在验证编译器设置"%1"时遇到了下列问题:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2597"/>
|
||||
<location filename="settings.cpp" line="2602"/>
|
||||
<source>Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths?</source>
|
||||
<translation>是否让小熊猫C++删除这些配置,并尝试重新建立配置?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2599"/>
|
||||
<location filename="settings.cpp" line="2604"/>
|
||||
<source>Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes.</source>
|
||||
<translation>如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果,</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2623"/>
|
||||
<location filename="settings.cpp" line="2629"/>
|
||||
<location filename="settings.cpp" line="2628"/>
|
||||
<location filename="settings.cpp" line="2634"/>
|
||||
<source>Compiler set not configuared.</source>
|
||||
<translation>未配置编译器设置。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settings.cpp" line="2625"/>
|
||||
<location filename="settings.cpp" line="2630"/>
|
||||
<source>Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? </source>
|
||||
<translation>您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2</translation>
|
||||
</message>
|
||||
|
@ -6244,13 +6269,13 @@ Are you really want to continue?</oldsource>
|
|||
<translation>C++包含文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="112"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="111"/>
|
||||
<location filename="settingsdialog/projectcompilerwidget.cpp" line="80"/>
|
||||
<source>No</source>
|
||||
<translation>否</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="113"/>
|
||||
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="112"/>
|
||||
<location filename="settingsdialog/projectcompilerwidget.cpp" line="81"/>
|
||||
<source>Yes</source>
|
||||
<translation>是</translation>
|
||||
|
@ -6753,7 +6778,7 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="39"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="154"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="264"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="272"/>
|
||||
<source>Replace</source>
|
||||
<translation>替换</translation>
|
||||
</message>
|
||||
|
@ -6763,10 +6788,36 @@ Are you really want to continue?</oldsource>
|
|||
<translation>在文件中替换</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="265"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="256"/>
|
||||
<source>Continue Search</source>
|
||||
<oldsource>Search Around</oldsource>
|
||||
<translation>继续查找</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="257"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="294"/>
|
||||
<source>End of file has been reached. </source>
|
||||
<oldsource>End of file has been reached.</oldsource>
|
||||
<translation>已到达文件结尾。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="258"/>
|
||||
<location filename="widgets/searchdialog.cpp" line="295"/>
|
||||
<source>Do you want to continue from file's beginning?</source>
|
||||
<oldsource>Do you want to start from beginning?</oldsource>
|
||||
<translation>是否从文件开头继续?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="273"/>
|
||||
<source>Replace this occurrence of ''%1''?</source>
|
||||
<translation>替换这里的"%1"?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="widgets/searchdialog.cpp" line="293"/>
|
||||
<source>Continue Replace</source>
|
||||
<oldsource>Replace Around</oldsource>
|
||||
<translation>继续替换</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SearchResultListModel</name>
|
||||
|
@ -7368,7 +7419,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>无法读取文件'%1'!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qsynedit/TextBuffer.cpp" line="615"/>
|
||||
<location filename="qsynedit/TextBuffer.cpp" line="629"/>
|
||||
<source>Can't open file '%1' for save!</source>
|
||||
<translation>无法写入文件'%2'!</translation>
|
||||
</message>
|
||||
|
|
|
@ -4755,7 +4755,7 @@ void SynEdit::doSetSelText(const QString &Value)
|
|||
}
|
||||
|
||||
int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynSearchOptions sOptions, PSynSearchBase searchEngine,
|
||||
SynSearchMathedProc matchedCallback)
|
||||
SynSearchMathedProc matchedCallback, SynSearchConfirmAroundProc confirmAroundCallback)
|
||||
{
|
||||
if (!searchEngine)
|
||||
return 0;
|
||||
|
@ -4917,9 +4917,10 @@ int SynEdit::searchReplace(const QString &sSearch, const QString &sReplace, SynS
|
|||
ptCurrent.Line--;
|
||||
else
|
||||
ptCurrent.Line++;
|
||||
if (
|
||||
((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line))
|
||||
&& bFromCursor){
|
||||
if (((ptCurrent.Line < ptStart.Line) || (ptCurrent.Line > ptEnd.Line))
|
||||
&& bFromCursor && sOptions.testFlag(ssoWrapAround)){
|
||||
if (confirmAroundCallback && !confirmAroundCallback())
|
||||
break;
|
||||
//search start from cursor, search has finished but no result founds
|
||||
bFromCursor = false;
|
||||
ptStart.Char = 1;
|
||||
|
|
|
@ -147,6 +147,7 @@ using SynPaintProc = std::function<void(const QPaintDevice& paintDevice )>;
|
|||
// SynFontStyles& style, QColor& foreground, QColor& background)>;
|
||||
using SynSearchMathedProc = std::function<SynSearchAction(const QString& sSearch,
|
||||
const QString& sReplace, int Line, int ch, int wordLen)>;
|
||||
using SynSearchConfirmAroundProc = std::function<bool ()>;
|
||||
|
||||
class SynEdit;
|
||||
using PSynEdit = std::shared_ptr<SynEdit>;
|
||||
|
@ -244,7 +245,8 @@ public:
|
|||
void setSelText(const QString& text);
|
||||
|
||||
int searchReplace(const QString& sSearch, const QString& sReplace, SynSearchOptions options,
|
||||
PSynSearchBase searchEngine, SynSearchMathedProc matchedCallback = nullptr);
|
||||
PSynSearchBase searchEngine, SynSearchMathedProc matchedCallback = nullptr,
|
||||
SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
|
||||
|
||||
int maxScrollWidth() const;
|
||||
int maxScrollHeight() const;
|
||||
|
|
|
@ -720,7 +720,6 @@ void SynEditTextPainter::PaintFoldAttributes()
|
|||
// Now loop through all the lines. The indices are valid for Lines.
|
||||
for (cRow = aFirstRow; cRow<=aLastRow;cRow++) {
|
||||
vLine = edit->rowToLine(cRow);
|
||||
qDebug()<<cRow<<vLine;
|
||||
if (vLine > edit->mLines->count() && edit->mLines->count() > 0)
|
||||
break;
|
||||
// Set vertical coord
|
||||
|
|
|
@ -59,7 +59,6 @@ CompilerSetOptionWidget::~CompilerSetOptionWidget()
|
|||
|
||||
void CompilerSetOptionWidget::init()
|
||||
{
|
||||
ui->cbEncoding->setVisible(false);
|
||||
ui->cbEncodingDetails->setVisible(false);
|
||||
ui->cbEncoding->clear();
|
||||
ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT);
|
||||
|
@ -144,7 +143,6 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
|
|||
ui->txtResourceCompiler->setText(pSet->resourceCompiler());
|
||||
ui->txtProfiler->setText(pSet->profiler());
|
||||
|
||||
ui->cbEncoding->setVisible(pSet->autoAddCharsetParams());
|
||||
if (pSet->execCharset() == ENCODING_AUTO_DETECT
|
||||
|| pSet->execCharset() == ENCODING_SYSTEM_DEFAULT
|
||||
|| pSet->execCharset() == ENCODING_UTF8) {
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="chkAutoAddCharset">
|
||||
<property name="text">
|
||||
<string>Convert Executable's Charset</string>
|
||||
<string>Convert Executable's Charset as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -250,7 +250,15 @@ void SearchDialog::on_btnExecute_clicked()
|
|||
if (actionType == SearchAction::Find) {
|
||||
Editor *e = pMainWindow->editorList()->getEditor();
|
||||
if (e!=nullptr) {
|
||||
findCount+=execute(e,ui->cbFind->currentText(),"");
|
||||
findCount+=execute(e,ui->cbFind->currentText(),"",nullptr,
|
||||
[](){
|
||||
return QMessageBox::question(pMainWindow,
|
||||
tr("Continue Search"),
|
||||
tr("End of file has been reached. ")
|
||||
+tr("Do you want to continue from file's beginning?"),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::Yes) == QMessageBox::Yes;
|
||||
});
|
||||
}
|
||||
} else if (actionType == SearchAction::Replace) {
|
||||
Editor *e = pMainWindow->editorList()->getEditor();
|
||||
|
@ -279,6 +287,14 @@ void SearchDialog::on_btnExecute_clicked()
|
|||
} else {
|
||||
return SynSearchAction::ReplaceAll;
|
||||
}
|
||||
},
|
||||
[](){
|
||||
return QMessageBox::question(pMainWindow,
|
||||
tr("Continue Replace"),
|
||||
tr("End of file has been reached. ")
|
||||
+tr("Do you want to continue from file's beginning?"),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::Yes) == QMessageBox::Yes;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -376,7 +392,9 @@ void SearchDialog::on_btnExecute_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace, SynSearchMathedProc matchCallback)
|
||||
int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace,
|
||||
SynSearchMathedProc matchCallback,
|
||||
SynSearchConfirmAroundProc confirmAroundCallback)
|
||||
{
|
||||
if (editor==nullptr)
|
||||
return 0;
|
||||
|
@ -398,7 +416,7 @@ int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString
|
|||
}
|
||||
|
||||
return editor->searchReplace(sSearch, sReplace, mSearchOptions,
|
||||
mSearchEngine, matchCallback);
|
||||
mSearchEngine, matchCallback, confirmAroundCallback);
|
||||
}
|
||||
|
||||
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword)
|
||||
|
|
|
@ -61,7 +61,9 @@ private slots:
|
|||
void on_btnExecute_clicked();
|
||||
private:
|
||||
int execute(SynEdit* editor, const QString& sSearch,
|
||||
const QString& sReplace, SynSearchMathedProc matchCallback = nullptr);
|
||||
const QString& sReplace,
|
||||
SynSearchMathedProc matchCallback = nullptr,
|
||||
SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
|
||||
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword);
|
||||
private:
|
||||
Ui::SearchDialog *ui;
|
||||
|
|
Loading…
Reference in New Issue