This is something that has annoyed me for a looong time, and I have to
thank uwe for making me look at it finally. I think the following
patch is correct, but since I know how fragile this code is, I prefer
to post it first.

The only thing it does is: when the last paragraph that is cut is
completely erased, we always delete it.

Juergen, this is a candidate for branch too (maybe for 1.5.5 if you
prefer).

JMarc

svndiff src/CutAndPaste.cpp

Index: src/CutAndPaste.cpp
===================================================================
--- src/CutAndPaste.cpp	(revision 23017)
+++ src/CutAndPaste.cpp	(working copy)
@@ -310,7 +310,9 @@ PitPosPair eraseSelectionHelper(BufferPa
 
 		// Separate handling of paragraph break:
 		if (merge && pit != endpit &&
-		    (pit + 1 != endpit || pars[pit].hasSameLayout(pars[endpit]))) {
+		    (pit + 1 != endpit 
+		     || pars[pit].hasSameLayout(pars[endpit])
+		     || pars[endpit].size() == endpos)) {
 			if (pit + 1 == endpit)
 				endpos += pars[pit].size();
 			mergeParagraph(params, pars, pit);

Reply via email to