From 63a9d8adedd5e9b2fcc689aae843c491f47261dd Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Mon, 10 Jan 2022 08:36:19 -0900 Subject: SwNavigator: fix outline delete removes first character of next outline paragraph The to be deleted outline selection may already be to the start of the following outline paragraph as happens when a table is the last content of the to be deleted outline. In this case do not extend the selection right or the first character of the following outline paragraph will be removed. Also check if no selection was made which indicates an empty paragraph and the selection right is needed. Change-Id: I5b2516bd7b1e88ee415986dbe9313f93039dbac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128264 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sw/source/uibase/utlui/content.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sw/source/uibase/utlui') diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 19bf803c6fe9..0a796d77711e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -4731,7 +4731,13 @@ void SwContentTree::DeleteOutlineSelections() SwOutlineNodes::size_type nActPos = reinterpret_cast(m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos(); m_pActiveShell->SttSelect(); m_pActiveShell->MakeOutlineSel(nActPos, nActPos, !m_xTreeView->get_row_expanded(rEntry), false); // select children if not expanded - m_pActiveShell->Right(CRSR_SKIP_CHARS, true, 1, false); + // The outline selection may already be to the start of the following outline paragraph + // as happens when a table is the last content of the to be deleted outline. In this case + // do not extend the to be deleted selection right or the first character of the following + // outline paragraph will be removed. Also check if no selection was made which indicates + // an empty paragraph and selection right is needed. + if (!m_pActiveShell->IsSttPara() || !m_pActiveShell->HasSelection()) + m_pActiveShell->Right(CRSR_SKIP_CHARS, true, 1, false); m_pActiveShell->EndSelect(); return false; }); -- cgit