diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-07 19:01:24 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-06-21 23:40:02 +0200 |
commit | 6bd76edc7ffd82690068618e5b322787228bb5d2 (patch) | |
tree | db093a0f33cc691c1e1b1480fa1321606b9645c9 /sw/source/core/docnode/ndsect.cxx | |
parent | 97a8db45e6ad8fb397edf5e239384637353f0b2f (diff) |
tdf#133957 sw: don't delete flys on Backspace/Delete keys
Also fixes: tdf#134007 tdf#138835 tdf#139514
When a character is deleted via the keyboard by Backspace or Delete key,
an artificial selection is created in SwWrtShell::DelLeft()/DelRight().
Ideally this should not delete flys that may be anchored to the
paragraphs, but unfortunately this may happen if there are only 2 empty
paragraphs in the section, because then the artificial selection cannot
be distinguished by the SwDoc implementation from a selection from
Ctrl+A (Select All), which *should* delete the flys.
So introduce a new flag that needs to be passed down multiple layers so
that SwUndoDelete can use it to determine if flys should be deleted, and
translating it to a flag that had been introduced to preserve flys in
ReplaceRange() previously.
There are a couple more callers that look like they want to "replace"
some text, so guess a bit at where to set this new flag.
(note: of course fly anchored *as char* must be deleted via keys.)
(regression from commit e75dd1fc992f168f24d66595265a978071cdd277)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135476
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 85376a02348810812d515ee72140dbf56f2b6040)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135517
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 5192cd430e8cab0ed04f8c70c5194397455ac705)
Change-Id: Ib4467476b12a12aefbbcb74ab9802f9318cf9aa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136217
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/core/docnode/ndsect.cxx')
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 8c2efee0eb7e..6154cfc7d776 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -535,7 +535,7 @@ void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes ) { SwNodeIndex aUpdIdx( *pIdx ); SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd ); - GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDelete>( aPaM )); + GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoDelete>(aPaM, SwDeleteFlags::Default)); if( pFootnoteEndAtTextEnd ) GetFootnoteIdxs().UpdateFootnote( aUpdIdx ); getIDocumentState().SetModified(); |