summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-12-24 13:24:30 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-01-15 16:04:40 +0100
commit79bfb54665b1a8dc2b932318eb6915d300772cff (patch)
tree923af4d5b8bd0b9049e7f887f5c9a7f6727bcd42 /editeng
parentb4f6a6c143567187c6d0f374b2b9f853ecc63af0 (diff)
tdf#137459 editeng: Ctrl+Del must only delete right
If there was nothing else at the end of the paragraph, Ctrl+Del was acting like Ctrl+Backspace - it turned around and started deleting the earlier words. Instead, we need to keep deleting to the right, starting with the next paragraph. That's what Ctrl-Backspace does in reverse anyway. It looks like this was just a copy-paste mistake already seen at original import and the few times that people tried to fix up this area, they didn't notice that apparently? But then again, the code changes don't look that impressive either... [if x == 1, set x=1?] make UITest_writer_tests UITEST_TEST_NAME=\ tdf137459_editeng_ctrl-DEL.tdf137459.test_tdf137459 Change-Id: I0c2268f9f1a2102997b2e84b0b7a6d0e2da43b15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108265 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit2.cxx29
1 files changed, 7 insertions, 22 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index d2596ebd9065..8ea35eb3e91f 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2359,34 +2359,19 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n
else if ( nDelMode == DeleteMode::RestOfWord )
{
aDelEnd = EndOfWord( aCurPos );
-
if (aDelEnd.GetIndex() == aCurPos.GetIndex())
{
const sal_Int32 nLen(aCurPos.GetNode()->Len());
-
- // #i120020# when 0 == nLen, aDelStart needs to be adapted, not
- // aDelEnd. This would (and did) lead to a wrong order in the
- // ImpConnectParagraphs call later.
- if(nLen)
+ // end of para?
+ if (aDelEnd.GetIndex() == nLen)
{
- // end of para?
- if (aDelEnd.GetIndex() == nLen)
- {
- aDelEnd = WordLeft( aCurPos );
- }
- else // there's still sth to delete on the right
- {
- aDelEnd = EndOfWord( WordRight( aCurPos ) );
- // if there'n no next word...
- if (aDelEnd.GetIndex() == nLen )
- {
- aDelEnd.SetIndex( nLen );
- }
- }
+ ContentNode* pNext = GetNextVisNode( aCurPos.GetNode() );
+ if ( pNext )
+ aDelEnd = EditPaM( pNext, 0 );
}
- else
+ else // there's still something to delete on the right
{
- aDelStart = WordLeft(aCurPos);
+ aDelEnd = EndOfWord( WordRight( aCurPos ) );
}
}
}