summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-08 22:50:58 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-08 23:09:40 +0200
commitd918a8086af56d1869e465baae64d960e56066d1 (patch)
tree0d2c2992b9eca1dbf52a6732197df40f808eb812
parent9c1826d98065c30411cbf2e731560165ca2b7668 (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
-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 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 );