fix: vertical selection speed

This commit is contained in:
Roy Qu 2024-03-22 22:43:21 +08:00
parent 7c29f4a964
commit 51a05e1bc6
4 changed files with 7 additions and 17 deletions

View File

@ -1461,7 +1461,7 @@ void Settings::Editor::doLoad()
mScrollPastEol = boolValue("scroll_past_eol", false);
mHalfPageScroll = boolValue("half_page_scroll",false);
mMouseWheelScrollSpeed = intValue("mouse_wheel_scroll_speed", 3);
mMouseSelectionScrollSpeed = intValue("mouse_selection_scroll_speed",1);
mMouseSelectionScrollSpeed = intValue("mouse_selection_scroll_speed",10);
//right edge

View File

@ -436,7 +436,7 @@
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
<number>999</number>
</property>
</widget>
</item>

View File

@ -1771,11 +1771,7 @@ void QSynEdit::doMouseScroll(bool isDragging, int scrollX, int scrollY)
}
if (scrollY != 0) {
int y;
//qDebug()<<mScrollDeltaY;
if (QApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier))
setTopPos(mTopPos + scrollY * mLinesInWindow * mTextHeight);
else
setTopPos(mTopPos + scrollY * mMouseSelectionScrollSpeed * mTextHeight);
setTopPos(mTopPos + scrollY * mMouseSelectionScrollSpeed);
y = yposToRow(0);
if (scrollY > 0) // scrolling down?
y+=mLinesInWindow - 1;
@ -2537,7 +2533,7 @@ void QSynEdit::computeCaret()
DisplayCoord vCaretNearestPos = pixelsToNearestGlyphPos(x, y);
vCaretNearestPos.row = minMax(vCaretNearestPos.row, 1, displayLineCount());
setInternalDisplayXY(vCaretNearestPos);
setInternalDisplayXY(vCaretNearestPos, false);
}
void QSynEdit::computeScroll(bool isDragging)
@ -2954,17 +2950,11 @@ void QSynEdit::decPaintLock()
Q_ASSERT(mPaintLock > 0);
mPaintLock--;
if (mPaintLock == 0 ) {
bool scrollbarUpdated = false;
if (mStateFlags.testFlag(StateFlag::sfHScrollbarChanged)) {
updateHScrollbar();
scrollbarUpdated = true;
}
if (mStateFlags.testFlag(StateFlag::sfVScrollbarChanged)) {
updateVScrollbar();
scrollbarUpdated = true;
}
if (scrollbarUpdated) {
ensureCursorPosVisible();
}
if (mStateFlags.testFlag(StateFlag::sfCaretChanged))
updateCaret();
@ -3079,10 +3069,10 @@ void QSynEdit::scrollWindow(int dx, int dy)
verticalScrollBar()->setValue(ny);
}
void QSynEdit::setInternalDisplayXY(const DisplayCoord &aPos)
void QSynEdit::setInternalDisplayXY(const DisplayCoord &aPos, bool ensureCaretVisible)
{
incPaintLock();
internalSetCaretXY(displayToBufferPos(aPos));
internalSetCaretXY(displayToBufferPos(aPos), ensureCaretVisible);
decPaintLock();
}

View File

@ -528,7 +528,7 @@ private:
void ensureCursorPosVisible();
void ensureCursorPosVisibleEx(bool ForceToMiddle);
void scrollWindow(int dx,int dy);
void setInternalDisplayXY(const DisplayCoord& aPos);
void setInternalDisplayXY(const DisplayCoord& aPos, bool ensureCaretVisible = true);
void internalSetCaretXY(const BufferCoord& Value, bool ensureCaretVisible = true);
void internalSetCaretX(int Value);
void internalSetCaretY(int Value);