Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

# Conflicts:
#	RedPandaIDE/compiler/projectcompiler.cpp
This commit is contained in:
royqh1979@gmail.com 2021-11-23 12:34:40 +08:00
commit 3e743a6a06
8 changed files with 76 additions and 29 deletions

View File

@ -1,3 +1,10 @@
Version 0.9.3 For Dev-C++ 7 Beta
- fix: the count in the title of issues view isn't correct
- fix: columns calculation not correct when paint lines containing chinese characters
- fix: restore caret position after reformat code
- enhancement: ask user to rebuild project, when run/debug the project and it has been modified
- fix: correct set the enabled state of "delete line"/"insert line"/"delete word"/"delete to BOL"/"delete to EOL" menu items
Version 0.9.2 For Dev-C++ 7 Beta
- fix: gutter of the disassembly code control in the cpu info dialog is grayed
- fix: problem set & problem views not correctly hidden when disabled in the executor / problem set options

View File

@ -330,8 +330,9 @@ void CompilerManager::onSyntaxCheckIssue(PCompileIssue issue)
{
if (issue->type == CompileIssueType::Error)
mSyntaxCheckErrorCount++;
if (issue->type == CompileIssueType::Error ||
issue->type == CompileIssueType::Warning)
mSyntaxCheckIssueCount++;
}
int CompilerManager::syntaxCheckIssueCount() const

View File

@ -876,7 +876,6 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
if (token.isEmpty())
return;
// qDebug()<<token<<"-"<<attr->name()<<" - "<<line<<" : "<<aChar;
if (mParser && highlighter() && (attr == highlighter()->identifierAttribute())) {
BufferCoord p{aChar,line};
BufferCoord pBeginPos,pEndPos;
@ -3569,6 +3568,8 @@ void Editor::reformat()
pSettings->dirs().app(),
args,
content);
int oldTopLine = topLine();
BufferCoord mOldCaret = caretXY();
selectAll();
SynEditorOptions oldOptions = getOptions();
@ -3576,6 +3577,8 @@ void Editor::reformat()
newOptions.setFlag(SynEditorOption::eoAutoIndent,false);
setOptions(newOptions);
setSelText(QString::fromUtf8(newContent));
setCaretXY(mOldCaret);
setTopLine(oldTopLine);
setOptions(oldOptions);
reparse();
checkSyntaxInBack();

View File

@ -339,6 +339,12 @@ void MainWindow::updateEditorActions()
ui->actionUnIndent->setEnabled(false);
ui->actionUndo->setEnabled(false);
ui->actionUnfoldAll->setEnabled(false);
ui->actionDelete_Line->setEnabled(false);
ui->actionDelete_Word->setEnabled(false);
ui->actionDuplicate_Line->setEnabled(false);
ui->actionDelete_to_BOL->setEnabled(false);
ui->actionDelete_to_EOL->setEnabled(false);
ui->actionFind->setEnabled(false);
ui->actionReplace->setEnabled(false);
ui->actionFind_Next->setEnabled(false);
@ -379,6 +385,11 @@ void MainWindow::updateEditorActions()
ui->actionToggleComment->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionUnIndent->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionUnfoldAll->setEnabled(e->lines()->count()>0);
ui->actionDelete_Line->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionDelete_Word->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionDuplicate_Line->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionDelete_to_BOL->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionDelete_to_EOL->setEnabled(!e->readOnly() && e->lines()->count()>0);
ui->actionFind->setEnabled(true);
ui->actionReplace->setEnabled(true);
@ -1079,30 +1090,14 @@ void MainWindow::checkSyntaxInBack(Editor *e)
mCompilerManager->checkSyntax(e->filename(),e->text(),
e->fileEncoding() == ENCODING_ASCII, nullptr);
}
// if not PrepareForCompile(cttStdin,True) then begin
// fCheckSyntaxInBack:=False;
// Exit;
// end;
// if e.InProject then begin
// if not assigned(MainForm.fProject) then
// Exit;
// fSyntaxChecker.Project := MainForm.fProject;
// end;
// fSyntaxChecker.CheckSyntax(True);
}
bool MainWindow::compile(bool rebuild)
{
CompileTarget target =getCompileTarget();
if (target == CompileTarget::Project) {
if (!mProject->saveUnits())
return false;
// Check if saves have been succesful
for (int i=0; i<mEditorList->pageCount();i++) {
Editor * e= (*(mEditorList))[i];
if (e->inProject() && e->modified())
return false;
}
if (mProject->modified())
mProject->saveAll();
clearIssues();
// Increment build number automagically
@ -1209,6 +1204,18 @@ void MainWindow::runExecutable(RunType runType)
{
CompileTarget target =getCompileTarget();
if (target == CompileTarget::Project) {
if (mProject->modified() &&
QMessageBox::question(
this,
tr("Rebuild Project"),
tr("Project has been modified, do you want to rebuild it?")
) == QMessageBox::Yes) {
mProject->saveAll();
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal;
compile();
return;
}
runExecutable(mProject->executable(),mProject->filename(),runType);
} else {
Editor * editor = mEditorList->getEditor();
@ -1277,6 +1284,17 @@ void MainWindow::debug()
}
return;
}
if (mProject->modified() &&
QMessageBox::question(
this,
tr("Compile Project"),
tr("Project has been modified, do you want to rebuild it?")
) == QMessageBox::Yes) {
mCompileSuccessionTask=std::make_shared<CompileSuccessionTask>();
mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug;
compile();
return;
}
// Did we choose a host application for our DLL?
if (mProject->options().type == ProjectType::DynamicLib) {
if (mProject->options().hostApplication.isEmpty()) {
@ -5703,7 +5721,6 @@ void MainWindow::on_actionDelete_Line_triggered()
}
}
void MainWindow::on_actionDuplicate_Line_triggered()
{
Editor *e=mEditorList->getEditor();

View File

@ -506,7 +506,7 @@
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>6</number>
<number>0</number>
</property>
<property name="iconSize">
<size>
@ -702,7 +702,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabDebugConsole">
<attribute name="title">
@ -1381,7 +1381,7 @@
<x>0</x>
<y>0</y>
<width>1114</width>
<height>25</height>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -2613,26 +2613,41 @@
<property name="text">
<string>Delete Line</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
<action name="actionDuplicate_Line">
<property name="text">
<string>Duplicate Line</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
</property>
</action>
<action name="actionDelete_Word">
<property name="text">
<string>Delete Word</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+D</string>
</property>
</action>
<action name="actionDelete_to_EOL">
<property name="text">
<string>Delete to EOL</string>
</property>
<property name="shortcut">
<string>Ctrl+Del</string>
</property>
</action>
<action name="actionDelete_to_BOL">
<property name="text">
<string>Delete to BOL</string>
</property>
<property name="shortcut">
<string>Ctrl+Backspace</string>
</property>
</action>
</widget>
<customwidgets>

View File

@ -250,6 +250,10 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
invalidateLine(mCaretY);
invalidateLine(oldCaretY);
}
if (mGutter.activeLineTextColor().isValid()) {
invalidateGutterLine(mCaretY);
invalidateGutterLine(oldCaretY);
}
mStatusChanges.setFlag(SynStatusChange::scCaretY);
}
// Call UpdateLastCaretX before DecPaintLock because the event handler it
@ -829,7 +833,7 @@ int SynEdit::columnToChar(int aLine, int aColumn) const
int SynEdit::stringColumns(const QString &line, int colsBefore) const
{
int columns = colsBefore;
int columns = std::max(0,colsBefore);
int charCols;
for (int i=0;i<line.length();i++) {
QChar ch = line[i];

View File

@ -995,7 +995,7 @@ void SynEditTextPainter::PaintLines()
edit->mHighlighter->next();
}
// Don't assume HL.GetTokenPos is valid after HL.GetEOL == True.
nTokenColumnsBefore += edit->stringColumns(sToken,nTokenColumnsBefore-1);
nTokenColumnsBefore += edit->stringColumns(sToken,nTokenColumnsBefore);
if (edit->mHighlighter->eol() && (nTokenColumnsBefore < vLastChar)) {
int lineColumns = edit->mLines->lineColumns(vLine-1);
// Draw text that couldn't be parsed by the highlighter, if any.