diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-07 19:01:24 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-08 20:31:40 +0200 |
commit | 85376a02348810812d515ee72140dbf56f2b6040 (patch) | |
tree | 98af17e59bf647695eebc9d2961cd83ce8639ea7 /sw/source/uibase/ribbar/inputwin.cxx | |
parent | 025231224b8b076e280235cd2b943addd2fb0755 (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)
Change-Id: Ib4467476b12a12aefbbcb74ab9802f9318cf9aa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135476
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/uibase/ribbar/inputwin.cxx')
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index a472fc3f227c..255ae24335ab 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -248,7 +248,7 @@ void SwInputWindow::ShowWin() if( m_pWrtShell->SwCursorShell::HasSelection() ) { m_pWrtShell->StartUndo( SwUndoId::DELETE ); - m_pWrtShell->Delete(); + m_pWrtShell->Delete(false); if( SwUndoId::EMPTY != m_pWrtShell->EndUndo( SwUndoId::DELETE )) { m_bCallUndo = true; @@ -470,7 +470,7 @@ void SwInputWindow::DelBoxContent() m_pWrtShell->MoveSection( GoCurrSection, fnSectionStart ); m_pWrtShell->SetMark(); m_pWrtShell->MoveSection( GoCurrSection, fnSectionEnd ); - m_pWrtShell->SwEditShell::Delete(); + m_pWrtShell->SwEditShell::Delete(false); m_pWrtShell->EndAllAction(); } } |