sw/source/uibase/docvw/SidebarTxtControl.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 92952f59f091b8f9a5092e27ae88bbd88de5e5f3
Author:     Neil Roberts <bpee...@yahoo.co.uk>
AuthorDate: Mon Aug 18 15:36:19 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 19 07:57:30 2025 +0200

    Don’t scroll to a comment after a keypress that doesn’t do anything
    
    Previously whenever SidebarTxtControl sees a keypress it was calling
    MakeVisible to scroll the comment into view. This happens even if the
    keypress doesn’t do anything such as pressing shift. This patch makes it
    instead only scroll the comment into view if PostKeyEvent returns true.
    
    An example of a usecase where this was particularily incovenient is when
    pressing Alt+Tab to look at another window. The initial alt press will
    make the view scroll back to the last comment you were editing. This is
    annoying if you are proofreading a long document while making
    occassional comments because you end up losing your place in the
    document.
    
    Note that, at least on GTK, typing actual text into the comment doesn’t
    make it scroll into view regardless of whether this patch is applied.
    That seems to be because the text input is handled with IM commands.
    That should probably be fixed too but I think it’s independent of this
    change.
    
    Change-Id: I324debee9ee2cc9d220a2b056362bea27da43e1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189884
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 652b8f7427e8..9be4bce31f9f 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -356,8 +356,6 @@ bool SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
     }
     else
     {
-        MakeVisible();
-
         tools::Long aOldHeight = mrSidebarWin.GetPostItTextHeight();
 
         /// HACK: need to switch off processing of Undo/Redo in Outliner
@@ -373,7 +371,10 @@ bool SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt 
)
                 mrDocView.GetWrtShell().InfoReadOnlyDialog(false);
         }
         if (bDone)
+        {
+            MakeVisible();
             mrSidebarWin.ResizeIfNecessary( aOldHeight, 
mrSidebarWin.GetPostItTextHeight() );
+        }
         else
         {
             // write back data first when showing navigator

Reply via email to