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

# Conflicts:
#	NEWS.md
This commit is contained in:
Roy Qu 2024-03-21 16:19:05 +08:00
commit c68eea9463
11 changed files with 47 additions and 21 deletions

View File

@ -62,6 +62,12 @@ Red Panda C++ Version 2.27
- change: Invert scroll direction in horizontal, like in vertical.
- enhancement: Show type completion info after 'const' and 'volatile'
- fix: Caret unseen when move to a long line end by press END.
- fix: No icons for inherited class private members.
- fix: Ctrl+Return insert linebreak shouldn't scroll unnecessarilly.
- enhancement: Move caret to line begin would scroll to the begin if possible.
- fix: Filename in tables in the debug panel are not correctly eroded.
- enhancement: Tooltip info for the stacktrace table in the debug panel.
- fix: '*=' is treadted as '*' when parsing.
- fix: Can't correctly retrieve function parameters type.
Red Panda C++ Version 2.26

View File

@ -1465,6 +1465,7 @@ QVariant BacktraceModel::data(const QModelIndex &index, int role) const
return QVariant();
switch (role) {
case Qt::DisplayRole:
case Qt::ToolTipRole:
switch (index.column()) {
case 0:
return trace->funcname;

View File

@ -308,6 +308,8 @@ QPixmap IconsManager::getPixmapForStatement(PStatement statement)
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_PROTECTED_METHOD));
} else if (statement->accessibility == StatementAccessibility::Public) {
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_METHOD));
} else {
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_METHOD));
}
} else {
if (statement->accessibility == StatementAccessibility::Protected) {
@ -329,6 +331,8 @@ QPixmap IconsManager::getPixmapForStatement(PStatement statement)
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_PROTECTD_VAR));
} else if (statement->accessibility == StatementAccessibility::Public) {
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_VAR));
} else {
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_VAR));
}
} else {
if (statement->accessibility == StatementAccessibility::Protected) {

View File

@ -205,10 +205,14 @@ MainWindow::MainWindow(QWidget *parent)
m=ui->tblBreakpoints->selectionModel();
ui->tblBreakpoints->setModel(mDebugger->breakpointModel().get());
delete m;
ui->tblBreakpoints->setTextElideMode(Qt::ElideRight);
ui->tblBreakpoints->setWordWrap(false);
m=ui->tblStackTrace->selectionModel();
ui->tblStackTrace->setModel(mDebugger->backtraceModel().get());
delete m;
ui->tblStackTrace->setTextElideMode(Qt::ElideRight);
ui->tblStackTrace->setWordWrap(false);
m=ui->watchView->selectionModel();
ui->watchView->setModel(mDebugger->watchModel().get());

View File

@ -1328,7 +1328,7 @@ void CppParser::addProjectFile(const QString &fileName, bool needScan)
//value.replace('/','\\'); // only accept full file names
// Update project listing
mProjectFiles.insert(fileName);
mProjectFiles.insert(fileName);
// Only parse given file
if (needScan && !mPreprocessor.fileScanned(fileName)) {
@ -1342,7 +1342,7 @@ PStatement CppParser::addInheritedStatement(const PStatement& derived, const PSt
PStatement statement = addStatement(
derived,
inherit->fileName,
inherit->type, // "Type" is already in use
inherit->type,
inherit->command,
inherit->args,
inherit->noNameArgs,
@ -2249,8 +2249,8 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
// function call, skip it
mIndex=moveToEndOfStatement(mIndex,true);
}
} else if (mTokenizer[mIndex]->text.startsWith('*')
|| mTokenizer[mIndex]->text.startsWith('&')
} else if (mTokenizer[mIndex]->text == "*"
|| mTokenizer[mIndex]->text == "&"
|| mTokenizer[mIndex]->text=="::"
|| tokenIsIdentifier(mTokenizer[mIndex]->text)
) {
@ -3930,8 +3930,8 @@ void CppParser::handleStructs(bool isTypedef)
int pos = mTokenizer[i]->text.indexOf('[');
command += mTokenizer[i]->text.mid(0,pos) + ' ';
args = mTokenizer[i]->text.mid(pos);
} else if (mTokenizer[i]->text.front() == '*'
|| mTokenizer[i]->text.front() == '&') { // do not add spaces after pointer operator
} else if (mTokenizer[i]->text == "*"
|| mTokenizer[i]->text == "&") { // do not add spaces after pointer operator
command += mTokenizer[i]->text;
} else {
command += mTokenizer[i]->text + ' ';
@ -4575,8 +4575,8 @@ void CppParser::internalParse(const QString &fileName)
handleInheritances();
// qDebug()<<"parse"<<timer.elapsed();
#ifdef QT_DEBUG
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
#endif
//reduce memory usage
internalClear();

View File

@ -98,4 +98,5 @@ void DebugGeneralWidget::on_chkOnlyMono_stateChanged(int)
} else {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
ui->cbFont->view()->reset();
}

View File

@ -65,6 +65,7 @@ void EditorFontWidget::on_chkGutterOnlyMonospacedFonts_stateChanged(int)
} else {
ui->cbGutterFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
ui->cbGutterFont->view()->reset();
}
void EditorFontWidget::on_btnAddFont_clicked()

View File

@ -82,4 +82,5 @@ void ExecutorProblemSetWidget::on_chkOnlyMonospaced_stateChanged(int )
} else {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
ui->cbFont->view()->reset();
}

View File

@ -1,5 +1,6 @@
#include "editorfontdialog.h"
#include "ui_editorfontdialog.h"
#include <QAbstractItemView>
EditorFontDialog::EditorFontDialog(QWidget *parent)
: QDialog(parent)
@ -28,6 +29,7 @@ void EditorFontDialog::on_chkMonoOnly_toggled(bool checked)
{
QString savedFont = ui->fontComboBox->currentFont().family();
ui->fontComboBox->setFontFilters(checked ? QFontComboBox::MonospacedFonts : QFontComboBox::AllFonts);
ui->fontComboBox->view()->reset();
ui->fontComboBox->setCurrentFont(QFont(savedFont));
}

View File

@ -3061,9 +3061,14 @@ void QSynEdit::ensureCursorPosVisibleEx(bool ForceToMiddle)
});
// Make sure X is visible
int visibleX = displayX();
if (visibleX < leftPos())
setLeftPos(visibleX);
else if (visibleX > viewWidth() + leftPos() && viewWidth()>0)
if (visibleX < leftPos()) {
if (viewWidth() / 3 >visibleX)
setLeftPos(0);
else if (viewWidth() > tabWidth() + mCharWidth)
setLeftPos(std::max(0,visibleX - tabWidth()));
else
setLeftPos(visibleX);
} else if (visibleX > viewWidth() + leftPos() && viewWidth()>0)
if (viewWidth() >= 3*mCharWidth )
setLeftPos(visibleX - viewWidth() + 3*mCharWidth);
else
@ -3100,9 +3105,9 @@ void QSynEdit::setInternalDisplayXY(const DisplayCoord &aPos)
decPaintLock();
}
void QSynEdit::internalSetCaretXY(const BufferCoord &Value)
void QSynEdit::internalSetCaretXY(const BufferCoord &Value, bool ensureCaretVisible)
{
setCaretXYEx(true, Value);
setCaretXYEx(ensureCaretVisible, Value);
}
void QSynEdit::internalSetCaretX(int Value)
@ -4871,7 +4876,7 @@ void QSynEdit::moveCaretVert(int deltaY, bool isSelection)
mLastCaretColumn = SaveLastCaretX;
}
void QSynEdit::moveCaretAndSelection(const BufferCoord &ptBefore, const BufferCoord &ptAfter, bool isSelection)
void QSynEdit::moveCaretAndSelection(const BufferCoord &ptBefore, const BufferCoord &ptAfter, bool isSelection, bool ensureCaretVisible)
{
if (mOptions.testFlag(EditorOption::eoGroupUndo)) {
mUndoList->addGroupBreak();
@ -4884,7 +4889,7 @@ void QSynEdit::moveCaretAndSelection(const BufferCoord &ptBefore, const BufferCo
setBlockEnd(ptAfter);
} else
setBlockBegin(ptAfter);
internalSetCaretXY(ptAfter);
internalSetCaretXY(ptAfter,ensureCaretVisible);
decPaintLock();
}
@ -4912,7 +4917,7 @@ void QSynEdit::moveCaretToLineStart(bool isSelection)
moveCaretAndSelection(caretXY(), BufferCoord{newX, mCaretY}, isSelection);
}
void QSynEdit::moveCaretToLineEnd(bool isSelection)
void QSynEdit::moveCaretToLineEnd(bool isSelection, bool ensureCaretVisible)
{
int vNewX;
if (mOptions.testFlag(EditorOption::eoEnhanceEndKey)) {
@ -4930,7 +4935,7 @@ void QSynEdit::moveCaretToLineEnd(bool isSelection)
} else
vNewX = displayLineText().length() + 1;
moveCaretAndSelection(caretXY(), BufferCoord{vNewX, mCaretY}, isSelection);
moveCaretAndSelection(caretXY(), BufferCoord{vNewX, mCaretY}, isSelection, ensureCaretVisible);
}
void QSynEdit::doGotoBlockStart(bool isSelection)
@ -5763,9 +5768,10 @@ void QSynEdit::executeCommand(EditCommand command, QChar ch, void *pData)
break;
case EditCommand::LineBreakAtEnd:
beginEditing();
addLeftTopToUndo();
addCaretToUndo();
addSelectionToUndo();
moveCaretToLineEnd(false);
moveCaretToLineEnd(false, false);
insertLine(true);
endEditing();
break;

View File

@ -529,7 +529,7 @@ private:
void ensureCursorPosVisibleEx(bool ForceToMiddle);
void scrollWindow(int dx,int dy);
void setInternalDisplayXY(const DisplayCoord& aPos);
void internalSetCaretXY(const BufferCoord& Value);
void internalSetCaretXY(const BufferCoord& Value, bool ensureCaretVisible = true);
void internalSetCaretX(int Value);
void internalSetCaretY(int Value);
void setStatusChanged(StatusChanges changes);
@ -574,9 +574,9 @@ private:
void moveCaretHorz(int deltaX, bool isSelection);
void moveCaretVert(int deltaY, bool isSelection);
void moveCaretAndSelection(const BufferCoord& ptBefore, const BufferCoord& ptAfter,
bool isSelection);
bool isSelection, bool ensureCaretVisible = true);
void moveCaretToLineStart(bool isSelection);
void moveCaretToLineEnd(bool isSelection);
void moveCaretToLineEnd(bool isSelection, bool ensureCaretVisible = true);
void doGotoBlockStart(bool isSelection);
void doGotoBlockEnd(bool isSelection);
void doGotoEditorStart(bool isSelection);