[Libreoffice-commits] core.git: vcl/source

Michael Stahl mstahl at redhat.com
Fri Sep 8 21:11:34 UTC 2017


 vcl/source/edit/texteng.cxx  |    2 +-
 vcl/source/edit/textview.cxx |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit d918a8086af56d1869e465baae64d960e56066d1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 8 22:50:58 2017 +0200

    tdf#108722 vcl: fix bugs in TextEngine with TEXTATTR_PROTECTED
    
    1. If the cursor is at the end of the paragraph, attributes ending
       at that position are skipped in TextEngine::FindCharAttrib().
    2. If a TEXTATTR_PROTECTED is found, TextView::KeyInput()
       retains the selection that was extended to cover the attribute
       after deleting the text, because it compares to the initial
       selection.
    
    Why delete/backspace keys only work with the "gtk" vcl-plug
    but not "gtk3", "gen" or "kde4" is a mystery to me.
    
    Change-Id: Id7a6f298332f5a99454c793dd2dd6d424a975ad4

diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 12731dfc3305..f1f3a408afc1 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1012,7 +1012,7 @@ const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt1
 {
     const TextCharAttrib* pAttr = nullptr;
     TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ];
-    if ( pNode && ( rPaM.GetIndex() < pNode->GetText().getLength() ) )
+    if (pNode && (rPaM.GetIndex() <= pNode->GetText().getLength()))
         pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
     return pAttr;
 }
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 40e2a99caa23..b19ad1767043 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -596,10 +596,12 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
                         if(pStartAttr && pStartAttr->GetStart() < mpImpl->maSelection.GetStart().GetIndex())
                         {
                             mpImpl->maSelection.GetStart().GetIndex() = pStartAttr->GetStart();
+                            aOldSel = mpImpl->maSelection; // update to deleted!
                         }
                         if(pEndAttr && pEndAttr->GetEnd() > mpImpl->maSelection.GetEnd().GetIndex())
                         {
                             mpImpl->maSelection.GetEnd().GetIndex() = pEndAttr->GetEnd();
+                            aOldSel = mpImpl->maSelection; // update to deleted!
                         }
                     }
                     aCurSel = ImpDelete( nDel, nMode );


More information about the Libreoffice-commits mailing list