sfx2/source/appl/newhelp.cxx |   17 ++++++++++++++++-
 sfx2/source/appl/newhelp.hxx |    1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit a2b1c7c071cc2bf847a603733b972df23e904ff6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Apr 5 16:44:39 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Apr 6 10:53:03 2022 +0200

    Resolves: rhbz#2069486 classic help index entry autocompletes on 
del/backspace
    
    when it shouldn't
    
    Change-Id: I90fa338479e0d5612d7b09f94c45e356ea71f89e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132596
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index ee4e2c32b955..9312a83ccd04 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -397,6 +397,7 @@ IndexTabPage_Impl::IndexTabPage_Impl(weld::Widget* pParent, 
SfxHelpIndexWindow_I
     , bIsActivated(false)
     , nRowHeight(m_xIndexList->get_height_rows(1))
     , nAllHeight(0)
+    , nLastCharCode(0)
 {
     m_xIndexList->set_size_request(m_xIndexList->get_approximate_digit_width() 
* 30, -1);
 
@@ -466,7 +467,19 @@ IMPL_LINK_NOARG(IndexTabPage_Impl, TreeChangeHdl, 
weld::TreeView&, void)
 
 IMPL_LINK_NOARG(IndexTabPage_Impl, EntryChangeHdl, weld::Entry&, void)
 {
-    aAutoCompleteIdle.Start();
+    switch (nLastCharCode)
+    {
+        case css::awt::Key::DELETE_WORD_BACKWARD:
+        case css::awt::Key::DELETE_WORD_FORWARD:
+        case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
+        case css::awt::Key::DELETE_TO_END_OF_LINE:
+        case KEY_BACKSPACE:
+        case KEY_DELETE:
+            break;
+        default:
+            aAutoCompleteIdle.Start();
+            break;
+    }
 }
 
 IMPL_LINK(IndexTabPage_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
@@ -531,6 +544,8 @@ IMPL_LINK(IndexTabPage_Impl, KeyInputHdl, const KeyEvent&, 
rKEvt, bool)
 //        m_bTreeChange = false;
         return true;
     }
+
+    nLastCharCode = nCode;
     return false;
 }
 
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 7d22336ecf83..f26bf93379a9 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -102,6 +102,7 @@ private:
     bool                bIsActivated;
     int                 nRowHeight;
     int                 nAllHeight;
+    sal_uInt16          nLastCharCode;
 
     void                InitializeIndex();
     void                ClearIndex();

Reply via email to