diff --git a/NEWS.md b/NEWS.md index f8a7364d..bbbc734c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,8 @@ Red Panda C++ Version 1.0.1 - change: ctrl+click symbol will goto definition, instead of got declaration - fix: when size of undo items is greater than the limit, old items should be poped in group - enhancement: max undo size in option dialog's editor->misc tab + - fix: when editor font is too small, fold signs on the gutter are not correctly displayed + - fix: expand fold signs on the gutter are not correct Red Panda C++ Version 1.0.0 - fix: calculation for code snippets's tab stop positions is not correct diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 044f21a5..ff689dcf 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -267,7 +267,9 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value) int oldCaretY = mCaretY; mCaretY = value.Line; invalidateLine(mCaretY); + invalidateGutterLine(mCaretY); invalidateLine(oldCaretY); + invalidateGutterLine(oldCaretY); mStatusChanges.setFlag(SynStatusChange::scCaretY); } // Call UpdateLastCaretX before DecPaintLock because the event handler it diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 415a5942..7fad0388 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -154,18 +154,18 @@ void SynEditTextPainter::paintGutter(const QRect& clip) // Draw the folding lines and squares if (edit->mUseCodeFolding) { - for (cRow = aFirstRow; cRow<=aLastRow; cRow++) { + for (cRow = aLastRow; cRow>=aFirstRow; cRow--) { vLine = edit->rowToLine(cRow); if ((vLine > edit->mLines->count()) && (edit->mLines->count() != 0)) - break; + continue; // Form a rectangle for the square the user can click on - //rcFold.Left := Gutter.RealGutterWidth(CharWidth) - Gutter.RightOffset; rcFold.setLeft(edit->mGutterWidth - edit->mGutter.rightOffset()); - rcFold.setRight(rcFold.left() + edit->mGutter.rightOffset() - 4); rcFold.setTop((cRow - edit->mTopLine) * edit->mTextHeight); + rcFold.setRight(rcFold.left() + edit->mGutter.rightOffset() - 4); rcFold.setBottom(rcFold.top() + edit->mTextHeight); + painter->setPen(edit->mCodeFolding.folderBarLinesColor); @@ -213,69 +213,16 @@ void SynEditTextPainter::paintGutter(const QRect& clip) if (FoldRange->collapsed) { x = rcFold.left() + (rcFold.width() / 2); painter->drawLine(x, rcFold.top() + 2, - x, rcFold.bottom() + 2); + x, rcFold.bottom() - 2); } } } } -// // the gutter separator if visible -// if (edit->mGutter.borderStyle <> gbsNone) and (AClip.Right >= fGutterWidth - 2) then -// with Canvas do begin -// Pen.Color := fGutter.BorderColor; -// Pen.Width := 1; -// with AClip do begin -// if fGutter.BorderStyle = gbsMiddle then begin -// MoveTo(fGutterWidth - 2, Top); -// LineTo(fGutterWidth - 2, Bottom); -// Pen.Color := fGutter.Color; -// end; -// MoveTo(fGutterWidth - 1, Top); -// LineTo(fGutterWidth - 1, Bottom); -// end; -// end; - -// // now the gutter marks -// if BookMarkOptions.GlyphsVisible and (Marks.Count > 0) and (aLastRow >= aFirstRow) then begin -// aGutterOffs := AllocMem((aLastRow - aFirstRow + 1) * SizeOf(integer)); -// vFirstLine := RowToLine(aFirstRow); -// vLastLine := RowToLine(aLastRow); -// try -// // Instead of making a two pass loop we look while drawing the bookmarks -// // whether there is any other mark to be drawn -// bHasOtherMarks := FALSE; -// for cMark := 0 to Marks.Count - 1 do -// with Marks[cMark] do -// if Visible and (Line >= vFirstLine) and (Line <= vLastLine) then begin -// if IsBookmark <> BookMarkOptions.DrawBookmarksFirst then -// bHasOtherMarks := TRUE -// else begin -// vMarkRow := LineToRow(Line); -// if vMarkRow >= aFirstRow then -// DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); -// end -// end; -// if bHasOtherMarks then -// for cMark := 0 to Marks.Count - 1 do -// with Marks[cMark] do begin -// if Visible and (IsBookmark <> BookMarkOptions.DrawBookmarksFirst) -// and (Line >= vFirstLine) and (Line <= vLastLine) then begin -// vMarkRow := LineToRow(Line); -// if vMarkRow >= aFirstRow then -// DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); -// end; -// end; -// if Assigned(OnGutterPaint) then -// for cRow := aFirstRow to aLastRow do begin -// OnGutterPaint(Self, cRow, aGutterOffs[cRow - aFirstRow], -// (vGutterRow - TopLine) * LineHeight); -// end; -// finally -// FreeMem(aGutterOffs); -// end; -// end; for (cRow = aFirstRow; cRow <=aLastRow; cRow++) { vLine = edit->rowToLine(cRow); + if ((vLine > edit->mLines->count()) && (edit->mLines->count() != 0)) + break; edit->onGutterPaint(*painter,vLine, 0, (cRow - edit->mTopLine) * edit->mTextHeight); } }