summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-06-07 19:01:24 +0200
committerAndras Timar <andras.timar@collabora.com>2022-06-24 13:42:24 +0200
commit7142ccc6b1178fabd1199f7d6c381fd665355529 (patch)
tree89ed4e1240d398a59b820b24e7ff902c6d036e36 /sw/qa/extras/uiwriter
parent60613727b957715086c1d9bb688e4ce40e978b98 (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> (cherry picked from commit 85376a02348810812d515ee72140dbf56f2b6040) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135517 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 1b90efde6bac..068a14113a0b 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1424,7 +1424,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132725)
dispatchCommand(mxComponent, ".uno:SwBackspace", {});
Scheduler::ProcessEventsToIdle();
- CPPUNIT_ASSERT_EQUAL(0, getShapes());
+ // tdf#137587 fly is no longer deleted by backspace
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString());
dispatchCommand(mxComponent, ".uno:Undo", {});
@@ -1438,7 +1439,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132725)
dispatchCommand(mxComponent, ".uno:Redo", {});
Scheduler::ProcessEventsToIdle();
- CPPUNIT_ASSERT_EQUAL(0, getShapes());
+ // tdf#137587 fly is no longer deleted by backspace
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString());
//Without the fix in place, it would crash here