- 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: 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: Positions of current matching parenthesis not correctly updated.
Red Panda C++ Version 2.26
- 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)
|| 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 (mTabStopY==caretY()) {
if (mLineAfterTabStop.isEmpty()) {
@ -1885,10 +1891,6 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
}
}
} 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?
int lineLength = lineText().length();
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(),' ');
}
sRightSide = line.mid(pos.ch - 1);
// if (mUndoing) {
// SpaceCount = 0;
// } else {
// SpaceCount = leftSpaces(sLeftSide);
// }
int caretY=pos.line;
// step1: insert the first line of Value into current line
if (text.length()>1) {
@ -5406,14 +5401,7 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList
// step2: insert remaining lines of Value
for (int i=1;i<text.length();i++) {
bool notInComment = true;
// if (mHighlighter) {
// notInComment = !mHighlighter->isCommentNotFinished(
// mHighlighter->getRangeState().state)
// && !mHighlighter->isStringNotFinished(
// mHighlighter->getRangeState().state);
// }
caretY=pos.line+i;
// mStatusChanges.setFlag(SynStatusChange::scCaretY);
if (text[i].isEmpty()) {
if (i==text.length()-1) {
str = sRightSide;

View File

@ -449,30 +449,26 @@ public:
void setBackgroundColor(const QColor &newBackgroundColor);
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:
void linesDeleted(int FirstLine, int Count);
void linesInserted(int FirstLine, int Count);
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 imeInputed(const QString& s);
// void contextHelp(const QString& word);
void statusChanged(StatusChanges changes);
void fontChanged();
void tabSizeChanged();
protected:
@ -727,11 +723,6 @@ private:
StatusChanges mStatusChanges;
int mLastKey;
Qt::KeyboardModifiers mLastKeyModifiers;
//fSearchEngine: TSynEditSearchCustom;
//fHookedCommandHandlers: TList;
//fKbdHandler: TSynEditKbdHandler;
// fFocusList: TList;
// fPlugins: TList;
QTimer* mScrollTimer;
PSynEdit fChainedEditor;
@ -740,20 +731,7 @@ private:
bool mIsScrolling;
int mOptionLock; // lock counter to prevent recalculate glyph widths while change settings;
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;
//caret blink related
int m_blinkTimerId;
int m_blinkStatus;
@ -799,23 +777,9 @@ protected:
bool viewportEvent(QEvent * event) override;
// QWidget interface
public:
public:
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:
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;