From 5eeba2e25fa6fbb5bcc714aa74cdc055d433e864 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 8 Mar 2026 16:30:09 +0500 Subject: [PATCH] tdf#171174: the target position is one less when moving to the right Change-Id: I13504468119706597ca25c14309e6548ea4ca588 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201207 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sc/source/ui/view/tabcont.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index cdb77fd4645b..c200f43959cf 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -551,7 +551,13 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) SCTAB nPos = GetPrivatDropPos( rEvt.maPosPixel ); HideDropPos(); - if ( nPos == pData->pCellTransfer->GetVisibleTab() && rEvt.mnAction == DND_ACTION_MOVE ) + SCTAB nOldPos = pData->pCellTransfer->GetVisibleTab(); + if (rEvt.mnAction == DND_ACTION_MOVE && nPos > nOldPos) + { + // when moving to the right, the position is one less after removing the table + --nPos; + } + if (nPos == nOldPos && rEvt.mnAction == DND_ACTION_MOVE) { // #i83005# do nothing - don't move to the same position // (too easily triggered unintentionally, and might take a long time in large documents)