- enhancement: Rename symbols won't remove all breakpoints/bookmarks
- enhancement: Batch replace won't remove all breakpoints/bookmarks - enhancement: Execute parameters can be used in debug.
This commit is contained in:
parent
06a528313d
commit
bc1b22ad25
3
NEWS.md
3
NEWS.md
|
@ -25,6 +25,9 @@ Red Panda C++ Version 2.8
|
||||||
- fix: Result of scope calculation not right if a for statement immediately follows another for statement.
|
- fix: Result of scope calculation not right if a for statement immediately follows another for statement.
|
||||||
- fix: Function parameters that is pointer,reference or array can't be correctly parsed.
|
- fix: Function parameters that is pointer,reference or array can't be correctly parsed.
|
||||||
- fix: In column mode, selection that contain lines with different length will cause error.
|
- fix: In column mode, selection that contain lines with different length will cause error.
|
||||||
|
- enhancement: Rename symbols won't remove all breakpoints/bookmarks
|
||||||
|
- enhancement: Batch replace won't remove all breakpoints/bookmarks
|
||||||
|
- enhancement: Execute parameters can be used in debug.
|
||||||
|
|
||||||
Red Panda C++ Version 2.7
|
Red Panda C++ Version 2.7
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
StdIn
|
StdIn
|
||||||
};
|
};
|
||||||
Compiler(const QString& filename, bool silent,bool onlyCheckSyntax);
|
Compiler(const QString& filename, bool silent,bool onlyCheckSyntax);
|
||||||
|
Compiler(const Compiler&)=delete;
|
||||||
|
Compiler& operator=(const Compiler&)=delete;
|
||||||
|
|
||||||
bool isRebuild() const;
|
bool isRebuild() const;
|
||||||
void setRebuild(bool isRebuild);
|
void setRebuild(bool isRebuild);
|
||||||
|
|
|
@ -80,6 +80,9 @@ class CompilerInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompilerInfo(const QString& name);
|
CompilerInfo(const QString& name);
|
||||||
|
CompilerInfo(const CompilerInfo&)=delete;
|
||||||
|
CompilerInfo& operator=(const CompilerInfo&)=delete;
|
||||||
|
|
||||||
const QList<PCompilerOption> &compilerOptions() const;
|
const QList<PCompilerOption> &compilerOptions() const;
|
||||||
const QString &name() const;
|
const QString &name() const;
|
||||||
PCompilerOption getCompilerOption(const QString& key) const;
|
PCompilerOption getCompilerOption(const QString& key) const;
|
||||||
|
|
|
@ -34,6 +34,8 @@ class CompilerManager : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CompilerManager(QObject *parent = nullptr);
|
explicit CompilerManager(QObject *parent = nullptr);
|
||||||
|
CompilerManager(const CompilerManager&)=delete;
|
||||||
|
CompilerManager& operator=(const CompilerManager&)=delete;
|
||||||
|
|
||||||
bool compiling();
|
bool compiling();
|
||||||
bool backgroundSyntaxChecking();
|
bool backgroundSyntaxChecking();
|
||||||
|
|
|
@ -27,6 +27,8 @@ class ExecutableRunner : public Runner
|
||||||
public:
|
public:
|
||||||
ExecutableRunner(const QString& filename, const QString& arguments, const QString& workDir,
|
ExecutableRunner(const QString& filename, const QString& arguments, const QString& workDir,
|
||||||
QObject* parent = nullptr);
|
QObject* parent = nullptr);
|
||||||
|
ExecutableRunner(const ExecutableRunner&)=delete;
|
||||||
|
ExecutableRunner& operator=(const ExecutableRunner&)=delete;
|
||||||
|
|
||||||
const QString &redirectInputFilename() const;
|
const QString &redirectInputFilename() const;
|
||||||
void setRedirectInputFilename(const QString &newDataFile);
|
void setRedirectInputFilename(const QString &newDataFile);
|
||||||
|
|
|
@ -26,7 +26,8 @@ public:
|
||||||
FileCompiler(const QString& filename, const QByteArray& encoding,
|
FileCompiler(const QString& filename, const QByteArray& encoding,
|
||||||
CppCompileType compileType,
|
CppCompileType compileType,
|
||||||
bool silent,bool onlyCheckSyntax);
|
bool silent,bool onlyCheckSyntax);
|
||||||
|
FileCompiler(const FileCompiler&)=delete;
|
||||||
|
FileCompiler& operator=(const FileCompiler&)=delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool prepareForCompile() override;
|
bool prepareForCompile() override;
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
explicit OJProblemCasesRunner(const QString& filename, const QString& arguments, const QString& workDir,
|
explicit OJProblemCasesRunner(const QString& filename, const QString& arguments, const QString& workDir,
|
||||||
POJProblemCase problemCase,
|
POJProblemCase problemCase,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
OJProblemCasesRunner(const OJProblemCasesRunner&)=delete;
|
||||||
|
OJProblemCasesRunner& operator=(const OJProblemCasesRunner&)=delete;
|
||||||
//max size of output buffer
|
//max size of output buffer
|
||||||
int bufferSize() const;
|
int bufferSize() const;
|
||||||
void setBufferSize(int newBufferSize);
|
void setBufferSize(int newBufferSize);
|
||||||
|
|
|
@ -27,6 +27,8 @@ class ProjectCompiler : public Compiler
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProjectCompiler(std::shared_ptr<Project> project, bool silent,bool onlyCheckSyntax);
|
ProjectCompiler(std::shared_ptr<Project> project, bool silent,bool onlyCheckSyntax);
|
||||||
|
ProjectCompiler(const ProjectCompiler&)=delete;
|
||||||
|
ProjectCompiler& operator=(const ProjectCompiler&)=delete;
|
||||||
void buildMakeFile();
|
void buildMakeFile();
|
||||||
|
|
||||||
bool onlyClean() const;
|
bool onlyClean() const;
|
||||||
|
|
|
@ -24,6 +24,8 @@ class Runner : public QThread
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Runner(const QString& filename, const QString& arguments, const QString& workDir, QObject *parent = nullptr);
|
explicit Runner(const QString& filename, const QString& arguments, const QString& workDir, QObject *parent = nullptr);
|
||||||
|
Runner(const Runner&)=delete;
|
||||||
|
Runner operator=(const Runner&)=delete;
|
||||||
|
|
||||||
bool pausing() const;
|
bool pausing() const;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ class StdinCompiler : public Compiler
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool silent,bool onlyCheckSyntax);
|
explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool silent,bool onlyCheckSyntax);
|
||||||
|
StdinCompiler(const StdinCompiler&)=delete;
|
||||||
|
StdinCompiler& operator=(const StdinCompiler&)=delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool prepareForCompile() override;
|
bool prepareForCompile() override;
|
||||||
|
|
|
@ -277,68 +277,89 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile(
|
||||||
void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &statement, const QString &newWord, const PCppParser &parser)
|
void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &statement, const QString &newWord, const PCppParser &parser)
|
||||||
{
|
{
|
||||||
QStringList buffer;
|
QStringList buffer;
|
||||||
Editor editor(nullptr);
|
Editor * oldEditor=pMainWindow->editorList()->getOpenedEditorByFilename(filename);
|
||||||
if (pMainWindow->editorList()->getContentFromOpenedEditor(
|
if (oldEditor){
|
||||||
filename,buffer)){
|
QSynedit::PSyntaxer syntaxer = syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP);
|
||||||
editor.document()->setContents(buffer);
|
int posY = 0;
|
||||||
|
while (posY < oldEditor->document()->count()) {
|
||||||
|
QString line = oldEditor->document()->getLine(posY);
|
||||||
|
if (posY == 0) {
|
||||||
|
syntaxer->resetState();
|
||||||
|
} else {
|
||||||
|
syntaxer->setState(
|
||||||
|
oldEditor->document()->getSyntaxState(posY-1));
|
||||||
|
}
|
||||||
|
syntaxer->setLine(line,posY);
|
||||||
|
QString newLine;
|
||||||
|
while (!syntaxer->eol()) {
|
||||||
|
int start = syntaxer->getTokenPos() + 1;
|
||||||
|
QString token = syntaxer->getToken();
|
||||||
|
if (token == statement->command) {
|
||||||
|
//same name symbol , test if the same statement;
|
||||||
|
QSynedit::BufferCoord p;
|
||||||
|
p.line = posY+1;
|
||||||
|
p.ch = start;
|
||||||
|
|
||||||
|
QStringList expression = oldEditor->getExpressionAtPosition(p);
|
||||||
|
PStatement tokenStatement = parser->findStatementOf(
|
||||||
|
filename,
|
||||||
|
expression, p.line);
|
||||||
|
if (tokenStatement
|
||||||
|
&& (tokenStatement->line == statement->line)
|
||||||
|
&& (tokenStatement->fileName == statement->fileName)) {
|
||||||
|
token = newWord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newLine += token;
|
||||||
|
syntaxer->next();
|
||||||
|
}
|
||||||
|
if (newLine!=line)
|
||||||
|
oldEditor->replaceLine(posY+1,newLine);
|
||||||
|
posY++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Editor editor(nullptr);
|
||||||
QByteArray encoding;
|
QByteArray encoding;
|
||||||
editor.document()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding);
|
editor.document()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding);
|
||||||
}
|
QStringList newContents;
|
||||||
QStringList newContents;
|
editor.setSyntaxer(syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP));
|
||||||
editor.setSyntaxer(syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP));
|
int posY = 0;
|
||||||
int posY = 0;
|
while (posY < editor.document()->count()) {
|
||||||
while (posY < editor.document()->count()) {
|
QString line = editor.document()->getLine(posY);
|
||||||
QString line = editor.document()->getLine(posY);
|
|
||||||
|
|
||||||
if (posY == 0) {
|
if (posY == 0) {
|
||||||
editor.syntaxer()->resetState();
|
editor.syntaxer()->resetState();
|
||||||
} else {
|
} else {
|
||||||
editor.syntaxer()->setState(
|
editor.syntaxer()->setState(
|
||||||
editor.document()->getSyntaxState(posY-1));
|
editor.document()->getSyntaxState(posY-1));
|
||||||
}
|
|
||||||
editor.syntaxer()->setLine(line,posY);
|
|
||||||
QString newLine;
|
|
||||||
while (!editor.syntaxer()->eol()) {
|
|
||||||
int start = editor.syntaxer()->getTokenPos() + 1;
|
|
||||||
QString token = editor.syntaxer()->getToken();
|
|
||||||
if (token == statement->command) {
|
|
||||||
//same name symbol , test if the same statement;
|
|
||||||
QSynedit::BufferCoord p;
|
|
||||||
p.line = posY+1;
|
|
||||||
p.ch = start;
|
|
||||||
|
|
||||||
QStringList expression = editor.getExpressionAtPosition(p);
|
|
||||||
PStatement tokenStatement = parser->findStatementOf(
|
|
||||||
filename,
|
|
||||||
expression, p.line);
|
|
||||||
if (tokenStatement
|
|
||||||
&& (tokenStatement->line == statement->line)
|
|
||||||
&& (tokenStatement->fileName == statement->fileName)) {
|
|
||||||
token = newWord;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
newLine += token;
|
editor.syntaxer()->setLine(line,posY);
|
||||||
editor.syntaxer()->next();
|
QString newLine;
|
||||||
}
|
while (!editor.syntaxer()->eol()) {
|
||||||
newContents.append(newLine);
|
int start = editor.syntaxer()->getTokenPos() + 1;
|
||||||
posY++;
|
QString token = editor.syntaxer()->getToken();
|
||||||
}
|
if (token == statement->command) {
|
||||||
|
//same name symbol , test if the same statement;
|
||||||
|
QSynedit::BufferCoord p;
|
||||||
|
p.line = posY+1;
|
||||||
|
p.ch = start;
|
||||||
|
|
||||||
Editor * oldEditor = pMainWindow->editorList()->getOpenedEditorByFilename(filename);
|
QStringList expression = editor.getExpressionAtPosition(p);
|
||||||
if (oldEditor) {
|
PStatement tokenStatement = parser->findStatementOf(
|
||||||
QSynedit::BufferCoord oldXY=oldEditor->caretXY();
|
filename,
|
||||||
int topLine = oldEditor->topLine();
|
expression, p.line);
|
||||||
int leftChar = oldEditor->leftChar();
|
if (tokenStatement
|
||||||
oldEditor->beginUndoBlock();
|
&& (tokenStatement->line == statement->line)
|
||||||
oldEditor->addLeftTopToUndo();
|
&& (tokenStatement->fileName == statement->fileName)) {
|
||||||
oldEditor->addCaretToUndo();
|
token = newWord;
|
||||||
oldEditor->replaceAll(newContents.join(oldEditor->lineBreak()));
|
}
|
||||||
oldEditor->setTopLine(topLine);
|
}
|
||||||
oldEditor->setLeftChar(leftChar);
|
newLine += token;
|
||||||
oldEditor->setCaretXY(oldXY);
|
editor.syntaxer()->next();
|
||||||
oldEditor->endUndoBlock();
|
}
|
||||||
} else {
|
newContents.append(newLine);
|
||||||
|
posY++;
|
||||||
|
}
|
||||||
QByteArray realEncoding;
|
QByteArray realEncoding;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
editor.document()->saveToFile(file,ENCODING_AUTO_DETECT,
|
editor.document()->saveToFile(file,ENCODING_AUTO_DETECT,
|
||||||
|
|
|
@ -130,7 +130,10 @@ bool Debugger::start(int compilerSetIndex, const QString& inferior, const QStrin
|
||||||
mWatchModel->resetAllVarInfos();
|
mWatchModel->resetAllVarInfos();
|
||||||
if (pSettings->debugger().useGDBServer()) {
|
if (pSettings->debugger().useGDBServer()) {
|
||||||
//deleted when thread finished
|
//deleted when thread finished
|
||||||
mTarget = new DebugTarget(inferior,compilerSet->debugServer(),pSettings->debugger().GDBServerPort());
|
QString params;
|
||||||
|
if (pSettings->executor().useParams())
|
||||||
|
params = pSettings->executor().params();
|
||||||
|
mTarget = new DebugTarget(inferior,compilerSet->debugServer(),pSettings->debugger().GDBServerPort(),params);
|
||||||
if (pSettings->executor().redirectInput())
|
if (pSettings->executor().redirectInput())
|
||||||
mTarget->setInputFile(pSettings->executor().inputFilename());
|
mTarget->setInputFile(pSettings->executor().inputFilename());
|
||||||
connect(mTarget, &QThread::finished,[this](){
|
connect(mTarget, &QThread::finished,[this](){
|
||||||
|
@ -2668,9 +2671,11 @@ DebugTarget::DebugTarget(
|
||||||
const QString &inferior,
|
const QString &inferior,
|
||||||
const QString &GDBServer,
|
const QString &GDBServer,
|
||||||
int port,
|
int port,
|
||||||
|
const QString& arguments,
|
||||||
QObject *parent):
|
QObject *parent):
|
||||||
QThread(parent),
|
QThread(parent),
|
||||||
mInferior(inferior),
|
mInferior(inferior),
|
||||||
|
mArguments(arguments),
|
||||||
mGDBServer(GDBServer),
|
mGDBServer(GDBServer),
|
||||||
mPort(port),
|
mPort(port),
|
||||||
mStop(false),
|
mStop(false),
|
||||||
|
@ -2720,7 +2725,7 @@ void DebugTarget::run()
|
||||||
QString arguments;
|
QString arguments;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
cmd= mGDBServer;
|
cmd= mGDBServer;
|
||||||
arguments = QString(" localhost:%1 \"%2\"").arg(mPort).arg(mInferior);
|
arguments = QString(" localhost:%1 \"%2\" %3").arg(mPort).arg(mInferior,mArguments);
|
||||||
#else
|
#else
|
||||||
cmd= pSettings->environment().terminalPath();
|
cmd= pSettings->environment().terminalPath();
|
||||||
arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior);
|
arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior);
|
||||||
|
|
|
@ -413,6 +413,7 @@ public:
|
||||||
explicit DebugTarget(const QString& inferior,
|
explicit DebugTarget(const QString& inferior,
|
||||||
const QString& GDBServer,
|
const QString& GDBServer,
|
||||||
int port,
|
int port,
|
||||||
|
const QString& arguments,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
void setInputFile(const QString& inputFile);
|
void setInputFile(const QString& inputFile);
|
||||||
void stopDebug();
|
void stopDebug();
|
||||||
|
@ -424,6 +425,7 @@ signals:
|
||||||
void processError(QProcess::ProcessError error);
|
void processError(QProcess::ProcessError error);
|
||||||
private:
|
private:
|
||||||
QString mInferior;
|
QString mInferior;
|
||||||
|
QString mArguments;
|
||||||
QString mGDBServer;
|
QString mGDBServer;
|
||||||
int mPort;
|
int mPort;
|
||||||
bool mStop;
|
bool mStop;
|
||||||
|
|
|
@ -2315,11 +2315,17 @@ void MainWindow::debug()
|
||||||
if (!debugInferiorhasBreakpoint()) {
|
if (!debugInferiorhasBreakpoint()) {
|
||||||
mDebugger->sendCommand("-break-insert","-t main");
|
mDebugger->sendCommand("-break-insert","-t main");
|
||||||
}
|
}
|
||||||
|
if (pSettings->executor().useParams()) {
|
||||||
|
mDebugger->sendCommand("-exec-arguments", pSettings->executor().params());
|
||||||
|
}
|
||||||
mDebugger->sendCommand("-exec-continue","");
|
mDebugger->sendCommand("-exec-continue","");
|
||||||
} else {
|
} else {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
mDebugger->sendCommand("-gdb-set", "new-console on");
|
mDebugger->sendCommand("-gdb-set", "new-console on");
|
||||||
#endif
|
#endif
|
||||||
|
if (pSettings->executor().useParams()) {
|
||||||
|
mDebugger->sendCommand("-exec-arguments", pSettings->executor().params());
|
||||||
|
}
|
||||||
if (!debugInferiorhasBreakpoint()) {
|
if (!debugInferiorhasBreakpoint()) {
|
||||||
mDebugger->sendCommand("-exec-run", "--start");
|
mDebugger->sendCommand("-exec-run", "--start");
|
||||||
} else {
|
} else {
|
||||||
|
@ -7707,12 +7713,11 @@ void MainWindow::on_btnReplace_clicked()
|
||||||
tr("Can't open file '%1' for replace!").arg(file->filename));
|
tr("Can't open file '%1' for replace!").arg(file->filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
contents = editor->contents();
|
|
||||||
for (int i=file->results.count()-1;i>=0;i--) {
|
for (int i=file->results.count()-1;i>=0;i--) {
|
||||||
const PSearchResultTreeItem& item = file->results[i];
|
const PSearchResultTreeItem& item = file->results[i];
|
||||||
if (!item->selected)
|
if (!item->selected)
|
||||||
continue;
|
continue;
|
||||||
QString line = contents[item->line-1];
|
QString line = editor->document()->getLine(item->line-1);
|
||||||
if (line.mid(item->start-1,results->keyword.length())!=results->keyword) {
|
if (line.mid(item->start-1,results->keyword.length())!=results->keyword) {
|
||||||
QMessageBox::critical(editor,
|
QMessageBox::critical(editor,
|
||||||
tr("Replace Error"),
|
tr("Replace Error"),
|
||||||
|
@ -7721,15 +7726,8 @@ void MainWindow::on_btnReplace_clicked()
|
||||||
}
|
}
|
||||||
line.remove(item->start-1,results->keyword.length());
|
line.remove(item->start-1,results->keyword.length());
|
||||||
line.insert(item->start-1, newWord);
|
line.insert(item->start-1, newWord);
|
||||||
contents[item->line-1] = line;
|
editor->replaceLine(item->line,line);
|
||||||
}
|
}
|
||||||
QSynedit::BufferCoord coord=editor->caretXY();
|
|
||||||
int topLine = editor->topLine();
|
|
||||||
int leftChar = editor->leftChar();
|
|
||||||
editor->replaceAll(contents.join(editor->lineBreak()));
|
|
||||||
editor->setCaretXY(coord);
|
|
||||||
editor->setTopLine(topLine);
|
|
||||||
editor->setLeftChar(leftChar);
|
|
||||||
}
|
}
|
||||||
showSearchReplacePanel(false);
|
showSearchReplacePanel(false);
|
||||||
stretchMessagesPanel(false);
|
stretchMessagesPanel(false);
|
||||||
|
|
|
@ -31,6 +31,9 @@ class CppParser : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CppParser(QObject *parent = nullptr);
|
explicit CppParser(QObject *parent = nullptr);
|
||||||
|
CppParser(const CppParser&)=delete;
|
||||||
|
CppParser& operator=(const CppParser)=delete;
|
||||||
|
|
||||||
~CppParser();
|
~CppParser();
|
||||||
|
|
||||||
void addHardDefineByLine(const QString& line);
|
void addHardDefineByLine(const QString& line);
|
||||||
|
|
|
@ -61,6 +61,9 @@ class CppPreprocessor
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit CppPreprocessor();
|
explicit CppPreprocessor();
|
||||||
|
CppPreprocessor(const CppPreprocessor&)=delete;
|
||||||
|
CppPreprocessor& operator=(const CppPreprocessor&)=delete;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void clearTempResults();
|
void clearTempResults();
|
||||||
|
|
|
@ -43,6 +43,8 @@ public:
|
||||||
using PToken = std::shared_ptr<Token>;
|
using PToken = std::shared_ptr<Token>;
|
||||||
using TokenList = QVector<PToken>;
|
using TokenList = QVector<PToken>;
|
||||||
explicit CppTokenizer();
|
explicit CppTokenizer();
|
||||||
|
CppTokenizer(const CppTokenizer&)=delete;
|
||||||
|
CppTokenizer& operator=(const CppTokenizer&)=delete;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void tokenize(const QStringList& buffer);
|
void tokenize(const QStringList& buffer);
|
||||||
|
|
|
@ -26,6 +26,8 @@ class StatementModel : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit StatementModel(QObject *parent = nullptr);
|
explicit StatementModel(QObject *parent = nullptr);
|
||||||
|
StatementModel(const StatementModel&)=delete;
|
||||||
|
StatementModel& operator=(const StatementModel&)=delete;
|
||||||
|
|
||||||
void add(const PStatement& statement);
|
void add(const PStatement& statement);
|
||||||
// function DeleteFirst: Integer;
|
// function DeleteFirst: Integer;
|
||||||
|
|
|
@ -169,6 +169,7 @@ enum class ChangeReason {
|
||||||
LineBreak,
|
LineBreak,
|
||||||
MoveSelectionUp,
|
MoveSelectionUp,
|
||||||
MoveSelectionDown,
|
MoveSelectionDown,
|
||||||
|
ReplaceLine,
|
||||||
Nothing // undo list empty
|
Nothing // undo list empty
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,9 @@ class QSynEditPainter
|
||||||
public:
|
public:
|
||||||
QSynEditPainter(QSynEdit * edit,QPainter* painter,int FirstRow, int LastRow,
|
QSynEditPainter(QSynEdit * edit,QPainter* painter,int FirstRow, int LastRow,
|
||||||
int FirstCol, int LastCol);
|
int FirstCol, int LastCol);
|
||||||
|
QSynEditPainter(const QSynEditPainter&)=delete;
|
||||||
|
QSynEditPainter& operator=(const QSynEditPainter&)=delete;
|
||||||
|
|
||||||
void paintTextLines(const QRect& clip);
|
void paintTextLines(const QRect& clip);
|
||||||
void paintGutter(const QRect& clip);
|
void paintGutter(const QRect& clip);
|
||||||
|
|
||||||
|
|
|
@ -4367,6 +4367,18 @@ void QSynEdit::doUndoItem()
|
||||||
ensureCursorPosVisible();
|
ensureCursorPosVisible();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ChangeReason::ReplaceLine:
|
||||||
|
qDebug()<<item->changeStartPos().line<<item->changeText();
|
||||||
|
mRedoList->addRedo(
|
||||||
|
item->changeReason(),
|
||||||
|
item->changeStartPos(),
|
||||||
|
item->changeEndPos(),
|
||||||
|
QStringList(mDocument->getLine(item->changeStartPos().line-1)),
|
||||||
|
item->changeSelMode(),
|
||||||
|
item->changeNumber()
|
||||||
|
);
|
||||||
|
mDocument->putLine(item->changeStartPos().line-1,item->changeText()[0]);
|
||||||
|
break;
|
||||||
case ChangeReason::MoveSelectionUp:
|
case ChangeReason::MoveSelectionUp:
|
||||||
setBlockBegin(BufferCoord{item->changeStartPos().ch, item->changeStartPos().line-1});
|
setBlockBegin(BufferCoord{item->changeStartPos().ch, item->changeStartPos().line-1});
|
||||||
setBlockEnd(BufferCoord{item->changeEndPos().ch, item->changeEndPos().line-1});
|
setBlockEnd(BufferCoord{item->changeEndPos().ch, item->changeEndPos().line-1});
|
||||||
|
@ -4564,6 +4576,17 @@ void QSynEdit::doRedoItem()
|
||||||
item->changeSelMode(),
|
item->changeSelMode(),
|
||||||
item->changeNumber());
|
item->changeNumber());
|
||||||
break;
|
break;
|
||||||
|
case ChangeReason::ReplaceLine:
|
||||||
|
mUndoList->restoreChange(
|
||||||
|
item->changeReason(),
|
||||||
|
item->changeStartPos(),
|
||||||
|
item->changeEndPos(),
|
||||||
|
QStringList(mDocument->getLine(item->changeStartPos().line-1)),
|
||||||
|
item->changeSelMode(),
|
||||||
|
item->changeNumber()
|
||||||
|
);
|
||||||
|
mDocument->putLine(item->changeStartPos().line-1,item->changeText()[0]);
|
||||||
|
break;
|
||||||
case ChangeReason::Insert:
|
case ChangeReason::Insert:
|
||||||
setCaretAndSelection(
|
setCaretAndSelection(
|
||||||
item->changeStartPos(),
|
item->changeStartPos(),
|
||||||
|
@ -6850,6 +6873,15 @@ void QSynEdit::setSelText(const QString &text)
|
||||||
doSetSelText(text);
|
doSetSelText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QSynEdit::replaceLine(int line, const QString &lineText)
|
||||||
|
{
|
||||||
|
BufferCoord pos;
|
||||||
|
pos.line=line;
|
||||||
|
pos.ch=1;
|
||||||
|
mUndoList->addChange(ChangeReason::ReplaceLine,pos,pos,QStringList(mDocument->getLine(line-1)),SelectionMode::Normal);
|
||||||
|
mDocument->putLine(line-1,lineText);
|
||||||
|
}
|
||||||
|
|
||||||
BufferCoord QSynEdit::blockBegin() const
|
BufferCoord QSynEdit::blockBegin() const
|
||||||
{
|
{
|
||||||
if (mActiveSelectionMode==SelectionMode::Column)
|
if (mActiveSelectionMode==SelectionMode::Column)
|
||||||
|
|
|
@ -138,6 +138,8 @@ class QSynEdit : public QAbstractScrollArea
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QSynEdit(QWidget* parent=nullptr);
|
explicit QSynEdit(QWidget* parent=nullptr);
|
||||||
|
QSynEdit(const QSynEdit&)=delete;
|
||||||
|
QSynEdit& operator=(const QSynEdit&)=delete;
|
||||||
/**
|
/**
|
||||||
* Returns how many rows are there in the editor
|
* Returns how many rows are there in the editor
|
||||||
* @return
|
* @return
|
||||||
|
@ -232,6 +234,7 @@ public:
|
||||||
void setSelLength(int Value);
|
void setSelLength(int Value);
|
||||||
void setSelText(const QString& text);
|
void setSelText(const QString& text);
|
||||||
|
|
||||||
|
void replaceLine(int line, const QString& lineText);
|
||||||
int searchReplace(const QString& sSearch, const QString& sReplace, SearchOptions options,
|
int searchReplace(const QString& sSearch, const QString& sReplace, SearchOptions options,
|
||||||
PSynSearchBase searchEngine, SearchMathedProc matchedCallback = nullptr,
|
PSynSearchBase searchEngine, SearchMathedProc matchedCallback = nullptr,
|
||||||
SearchConfirmAroundProc confirmAroundCallback = nullptr);
|
SearchConfirmAroundProc confirmAroundCallback = nullptr);
|
||||||
|
|
Loading…
Reference in New Issue