- fix: Positions of current matching parenthesis not correctly updated.

This commit is contained in:
Roy Qu 2024-04-13 18:01:32 +08:00
parent e3145d680f
commit 89f8d9ae21
4 changed files with 22 additions and 67 deletions

View File

@ -139,6 +139,7 @@ Red Panda C++ Version 2.27
- fix: Toggle breakpoint by shortcut may use wrong line. - fix: Toggle breakpoint by shortcut may use wrong line.
- fix: Size of the icons in problem and problem set panel are not correct. - fix: Size of the icons in problem and problem set panel are not correct.
- fix: Shouldn't consider preceeding '&'/'*' when popping completion suggest list for variable members. - fix: Shouldn't consider preceeding '&'/'*' when popping completion suggest list for variable members.
- fix: Positions of current matching parenthesis not correctly updated.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -1859,6 +1859,12 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
if (changes.testFlag(QSynedit::StatusChange::CaretX) if (changes.testFlag(QSynedit::StatusChange::CaretX)
|| changes.testFlag(QSynedit::StatusChange::CaretY)) { || changes.testFlag(QSynedit::StatusChange::CaretY)) {
if (pSettings->editor().highlightMathingBraces()) {
invalidateLine(mHighlightCharPos1.line);
invalidateLine(mHighlightCharPos2.line);
}
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
if (mTabStopBegin >=0) { if (mTabStopBegin >=0) {
if (mTabStopY==caretY()) { if (mTabStopY==caretY()) {
if (mLineAfterTabStop.isEmpty()) { if (mLineAfterTabStop.isEmpty()) {
@ -1885,10 +1891,6 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
} }
} }
} else if (!selAvail() && pSettings->editor().highlightMathingBraces()){ } else if (!selAvail() && pSettings->editor().highlightMathingBraces()){
invalidateLine(mHighlightCharPos1.line);
invalidateLine(mHighlightCharPos2.line);
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
// Is there a bracket char before us? // Is there a bracket char before us?
int lineLength = lineText().length(); int lineLength = lineText().length();
int ch = caretX() - 2; int ch = caretX() - 2;

View File

@ -5380,11 +5380,6 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList
sLeftSide += QString(pos.ch - 1 - sLeftSide.length(),' '); sLeftSide += QString(pos.ch - 1 - sLeftSide.length(),' ');
} }
sRightSide = line.mid(pos.ch - 1); sRightSide = line.mid(pos.ch - 1);
// if (mUndoing) {
// SpaceCount = 0;
// } else {
// SpaceCount = leftSpaces(sLeftSide);
// }
int caretY=pos.line; int caretY=pos.line;
// step1: insert the first line of Value into current line // step1: insert the first line of Value into current line
if (text.length()>1) { if (text.length()>1) {
@ -5406,14 +5401,7 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList
// step2: insert remaining lines of Value // step2: insert remaining lines of Value
for (int i=1;i<text.length();i++) { for (int i=1;i<text.length();i++) {
bool notInComment = true; bool notInComment = true;
// if (mHighlighter) {
// notInComment = !mHighlighter->isCommentNotFinished(
// mHighlighter->getRangeState().state)
// && !mHighlighter->isStringNotFinished(
// mHighlighter->getRangeState().state);
// }
caretY=pos.line+i; caretY=pos.line+i;
// mStatusChanges.setFlag(SynStatusChange::scCaretY);
if (text[i].isEmpty()) { if (text[i].isEmpty()) {
if (i==text.length()-1) { if (i==text.length()-1) {
str = sRightSide; str = sRightSide;

View File

@ -449,30 +449,26 @@ public:
void setBackgroundColor(const QColor &newBackgroundColor); void setBackgroundColor(const QColor &newBackgroundColor);
bool isEmpty(); bool isEmpty();
int mouseSelectionScrollSpeed() const;
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
ScrollStyle scrollBars() const;
void setScrollBars(ScrollStyle newScrollBars);
double lineSpacingFactor() const;
void setLineSpacingFactor(double newLineSpacingFactor);
const QDateTime &lastModifyTime() const;
const PFormatter &formatter() const;
void setFormatter(const PFormatter &newFormatter);
signals: signals:
void linesDeleted(int FirstLine, int Count); void linesDeleted(int FirstLine, int Count);
void linesInserted(int FirstLine, int Count); void linesInserted(int FirstLine, int Count);
void changed(); void changed();
// void chainUndoAdded();
// void chainRedoAdded();
// void chainLinesChanging();
// void chainLinesChanged();
// void chainListCleared();
// void chainListDeleted(int Index, int Count);
// void chainListInserted(int Index, int Count);
// void chainListPutted(int Index, int Count);
// void filesDropped(int X,int Y, const QStringList& AFiles);
void gutterClicked(Qt::MouseButton button, int x, int y, int line); void gutterClicked(Qt::MouseButton button, int x, int y, int line);
// void imeInputed(const QString& s);
// void contextHelp(const QString& word);
void statusChanged(StatusChanges changes); void statusChanged(StatusChanges changes);
void fontChanged(); void fontChanged();
void tabSizeChanged(); void tabSizeChanged();
protected: protected:
@ -727,11 +723,6 @@ private:
StatusChanges mStatusChanges; StatusChanges mStatusChanges;
int mLastKey; int mLastKey;
Qt::KeyboardModifiers mLastKeyModifiers; Qt::KeyboardModifiers mLastKeyModifiers;
//fSearchEngine: TSynEditSearchCustom;
//fHookedCommandHandlers: TList;
//fKbdHandler: TSynEditKbdHandler;
// fFocusList: TList;
// fPlugins: TList;
QTimer* mScrollTimer; QTimer* mScrollTimer;
PSynEdit fChainedEditor; PSynEdit fChainedEditor;
@ -740,20 +731,7 @@ private:
bool mIsScrolling; bool mIsScrolling;
int mOptionLock; // lock counter to prevent recalculate glyph widths while change settings; int mOptionLock; // lock counter to prevent recalculate glyph widths while change settings;
bool mUndoing; bool mUndoing;
// event handlers
// ProcessCommandProc mOnCommandProcessed;
// MouseCursorProc mOnMouseCursor;
// PaintProc mOnPaint;
// SynPreparePaintHighlightTokenProc mOnPaintHighlightToken;
// ProcessCommandProc mOnProcessingCommand;
// ProcessCommandProc mOnProcessingUserCommand;
// SynSpecialLineColorsProc mOnSpecialLineColors;
// SynEditingAreasProc mOnEditingAreas;
// SynGutterGetTextProc mOnGutterGetText;
// SynTGutterPaintProc mOnGutterPaint;
int mGutterWidth; int mGutterWidth;
//caret blink related //caret blink related
int m_blinkTimerId; int m_blinkTimerId;
int m_blinkStatus; int m_blinkStatus;
@ -799,23 +777,9 @@ protected:
bool viewportEvent(QEvent * event) override; bool viewportEvent(QEvent * event) override;
// QWidget interface // QWidget interface
public: public:
QVariant inputMethodQuery(Qt::InputMethodQuery property) const override; QVariant inputMethodQuery(Qt::InputMethodQuery property) const override;
int mouseSelectionScrollSpeed() const;
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
ScrollStyle scrollBars() const;
void setScrollBars(ScrollStyle newScrollBars);
double lineSpacingFactor() const;
void setLineSpacingFactor(double newLineSpacingFactor);
const QDateTime &lastModifyTime() const;
const PFormatter &formatter() const;
void setFormatter(const PFormatter &newFormatter);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;