From 3c9ac38913841683e5828b41eb8d53afb246cc72 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 24 Mar 2024 12:23:58 +0800 Subject: [PATCH] drag&drop tweak --- libs/qsynedit/qsynedit/qsynedit.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index a1a48be2..6972db71 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -6302,6 +6302,14 @@ void QSynEdit::dropEvent(QDropEvent *event) && coord>=mDragSelBeginSave && coord<=mDragSelEndSave) ) { mDocument->deleteAt(mDocument->count()-1); + int topPos = mTopPos; + if (topPos!=mMouseScrollOldTop) { + int offset = topPos % mTextHeight; + if (offset!=0) + topPos -= offset; + setTopPos(topPos); + ensureCaretVisible(); + } //do nothing if drag onto itself event->acceptProposedAction(); mDropped = true;