- fix: Caret unseen when move to a long line end by press END.

This commit is contained in:
Roy Qu 2024-03-20 20:42:20 +08:00
parent 92407fc767
commit bcbcc61481
2 changed files with 11 additions and 10 deletions

View File

@ -61,6 +61,7 @@ Red Panda C++ Version 2.27
- enhancement: "Mouse scroll direction" option in Options / Editor / General - enhancement: "Mouse scroll direction" option in Options / Editor / General
- change: Invert scroll direction in horizontal, like in vertical. - change: Invert scroll direction in horizontal, like in vertical.
- enhancement: Show type completion info after 'const' and 'volatile' - enhancement: Show type completion info after 'const' and 'volatile'
- fix: Caret unseen when move to a long line end by press END.
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

@ -266,14 +266,14 @@ void QSynEdit::setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value)
if (CallEnsureCursorPosVisible) if (CallEnsureCursorPosVisible)
ensureCursorPosVisible(); ensureCursorPosVisible();
} else { } else {
// Also call UpdateLastCaretX if the caret didn't move. Apps don't know // Also call UpdateLastCaretX if the caret didn't move. Apps don't know
// anything about fLastCaretX and they shouldn't need to. So, to avoid any // anything about fLastCaretX and they shouldn't need to. So, to avoid any
// unwanted surprises, always update fLastCaretX whenever CaretXY is // unwanted surprises, always update fLastCaretX whenever CaretXY is
// assigned to. // assigned to.
// Note to SynEdit developers: If this is undesirable in some obscure // Note to SynEdit developers: If this is undesirable in some obscure
// case, just save the value of fLastCaretX before assigning to CaretXY and // case, just save the value of fLastCaretX before assigning to CaretXY and
// restore it afterward as appropriate. // restore it afterward as appropriate.
updateLastCaretX(); updateLastCaretX();
} }
} }
@ -3063,8 +3063,8 @@ void QSynEdit::ensureCursorPosVisibleEx(bool ForceToMiddle)
int visibleX = displayX(); int visibleX = displayX();
if (visibleX < leftPos()) if (visibleX < leftPos())
setLeftPos(visibleX); setLeftPos(visibleX);
else if (visibleX >= viewWidth() + leftPos() && viewWidth()>0) else if (visibleX > viewWidth() + leftPos() && viewWidth()>0)
setLeftPos(visibleX - viewWidth() + 1); setLeftPos(visibleX - viewWidth() + mCharWidth);
else else
setLeftPos(leftPos()); setLeftPos(leftPos());
// Make sure Y is visible // Make sure Y is visible