From 8b783581a05b203dbf97d23ee0213c3846cc7cf5 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 3 Feb 2023 21:01:03 +0100 Subject: [PATCH] IDE: SourceEditor, fix selecting next tab when drag/drop moving an editor. The editor incorrectly switched to the 2nd next tab. Issue #40064 --- ide/sourceeditor.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index ebaf4bf0fe..5f5bfce548 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -7748,11 +7748,16 @@ begin FPageIndex := APageIndex + 1 else FPageIndex := APageIndex - 1; - if FUpdateLock = 0 then - ApplyPageIndex - else + if FUpdateLock = 0 then begin + ApplyPageIndex; + end + else begin + FNotebook.PageIndex := FPageIndex; // Avoid the WS doing this, when the page is deleted. Include(FUpdateFlags,ufPageIndexChanged); + end; end; + if FPageIndex > APageIndex then + dec(FPageIndex); NotebookPages.Delete(APageIndex); end else begin FPageIndex := -1;