The attached patch runs the DEPM when a selection is cleared. If this is
not done, there may be empty paragraphs and double whitespaces left behind.
Comments ?
Vincent
>From b4093a3b6a95aa07a08dcccc3e08b36dc4310060 Mon Sep 17 00:00:00 2001
From: Vincent van Ravesteijn <v...@lyx.org>
Date: Wed, 30 Apr 2014 15:18:06 +0200
Subject: [PATCH] Run DEPM when a selection is cleared
If a 'to-be-deleted' paragraph or whitespace is left while starting a
selection, the deleteEmptyParagraphMechanism (DEPM) is not run for the
anchor position. When the selection is cleared, there may be double
whitespaces and empty paragraphs left behind.
When Text::deleteEmptyParagraphMechanism(pit, pit, bool) is run, this
might even lead to an assertion (see bug #8017).
This patch runs the DEPM on the anchor position when the selection is
cleared.
Fixes: #8017
---
src/Cursor.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index c740315..404c73c 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -1282,8 +1282,13 @@ bool Cursor::selHandle(bool sel)
if (sel == selection())
return false;
- if (!sel)
+ if (!sel) {
cap::saveSelection(*this);
+ Cursor old(bv());
+ old.setCursor(anchor_);
+ bool need_anchor_change = false;
+ text()->deleteEmptyParagraphMechanism(*this, old,
need_anchor_change);
+ }
resetAnchor();
setSelection(sel);
--
1.9.2.msysgit.0