From d438864a4d0a059d911f9ddeba89cb39c35dae27 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 25 Aug 2022 16:53:06 +0800 Subject: [PATCH] - change: reduce time intervals for selection by mouse --- NEWS.md | 1 + RedPandaIDE/qsynedit/SynEdit.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 7bb8d1d4..510a8e5e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ Red Panda C++ Version 1.3 - enhancement: don't parse all openned files when start up - enhancement: don't parse files when close all and exit + - change: reduce time intervals for selection by mouse Red Panda C++ Version 1.2 diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 9c66cc23..1e18746d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -2005,7 +2005,13 @@ void SynEdit::doMouseScroll(bool isDragging) if (mOptions.testFlag(SynEditorOption::eoGroupUndo)) mUndoList->addGroupBreak(); } - computeScroll(isDragging); + if (isDragging) { + mScrollTimer->singleShot(20,this,&SynEdit::onDraggingScrollTimeout); + } else { + mScrollTimer->singleShot(20,this,&SynEdit::onScrollTimeout); + } + +// computeScroll(isDragging); } QString SynEdit::getDisplayStringAtLine(int line) const @@ -2756,11 +2762,7 @@ void SynEdit::computeScroll(bool isDragging) // if (mScrollDeltaX!=0 || mScrollDeltaY!=0) { - if (isDragging) { - mScrollTimer->singleShot(100,this,&SynEdit::onDraggingScrollTimeout); - } else { - mScrollTimer->singleShot(100,this,&SynEdit::onScrollTimeout); - } + doMouseScroll(isDragging); // } } @@ -6947,10 +6949,12 @@ void SynEdit::onGutterChanged() void SynEdit::onScrollTimeout() { - doMouseScroll(false); + computeScroll(false); + //doMouseScroll(false); } void SynEdit::onDraggingScrollTimeout() { - doMouseScroll(true); + computeScroll(true); + //doMouseScroll(true); }