summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-08 22:50:58 +0200
committerCaolán McNamara <caolanm@redhat.com>2017-09-14 17:58:38 +0200
commit96136c55a1fb5da6da2042bbfaa2f4e9aeb7938f (patch)
tree3b05a6276de9674e6f93ec0a63b775aa65447fcc
parentc5dbd79f37cb76a638af2c409acb200ea4ef5ffc (diff)
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 (cherry picked from commit d918a8086af56d1869e465baae64d960e56066d1) Reviewed-on: https://gerrit.libreoffice.org/42119 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/edit/texteng.cxx2
-rw-r--r--vcl/source/edit/textview.cxx2
2 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index cc50317037bc..d6f030921732 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 f3c1b1a47b3c..d0e11899a380 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -623,10 +623,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 );