On 15.10.2016 00:12, racoon wrote:
On 14.10.2016 17:14, racoon wrote:
On 13.10.2016 10:46, Guillaume Munch wrote:
Le 12/10/2016 à 20:02, racoon a écrit :
On 10.10.2016 17:49, Richard Heck wrote:
Here:

    ftp://ftp.lyx.org/pub/lyx/devel/lyx-2.2/2.2.2/

Please prepare binaries.

I am on 2.2.2 now. There is something strange happening when I
*replace*
stuff from the beginning of a paragraph before a space by pasting some
inset, e.g. note, label, citation, etc. It removes the following space.
Maybe someone can test it on 2.2.1 whether this is a new or old bug.

Details:

Steps to reproduce:
1. Start a new paragraph write two (or three or four or ...) words
(separated by a space)
2. Select the first (or first two or first three or ...) word(s) and
insert a label (or a citation or paste a note or ...)

Actual result:
- The space between the words vanishes

Expected result:
- It does not


I can reproduce with 2.1.5. I think this is an old bug.

It actually affects not only insets but any kind of pasting operation,
including text. Quite nasty bug I think. I can try to have a look at it
but it probably concerns areas I haven't looked at before.

Not sure what exactly it is yet. There is some (unnecessary) cleaning
going on when removing a selection. It is probably in the
eraseSelectionHelper in CutAndPaste.cpp. It seems to remove the leading
space in a paragraph when deleting from the beginning of the paragraph
up to a space. I guess the idea was that LyX does not allow for leading
spaces that's why they should be automatically removed.

But I guess they should not be. They will be cleaned up anyway after the
cursor leaves the paragraph. This is also the case at other places. For
example, when selecting the first word and replacing it by entering a
character the bug does not occur. Also, the leading space is not removed
when deleting the first word without selection, i.e. one character after
the other. That's why there must be a bug here as well or, what I find
more likely, the deletion of the leading space is really unnecessary.

Attached is a fix. Ironically the problem was actually a passage that is commented as 'necessary' (commented it out for now). It does not seem necessary to me. Maybe there is some advantage in erasing the leading space but, if at all, it has to be done more careful.

Daniel

From 967d723b5915e52dfbf5a230b8b9c440af1f01a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Ram=C3=B6ller?= <d....@web.de>
Date: Sat, 15 Oct 2016 00:35:17 +0200
Subject: [PATCH] Fixes that cutting selection from beginning of paragrph
 removes space after selection.

---
 src/CutAndPaste.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 4ec9811..888da0c 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -888,9 +888,9 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
                cur.pit() = endpit;
 
                // sometimes necessary
-               if (doclear
+               /*if (doclear
                        && 
text->paragraphs()[begpit].stripLeadingSpaces(bp.track_changes))
-                       cur.fixIfBroken();
+                       cur.fixIfBroken();*/
 
                // need a valid cursor. (Lgb)
                cur.clearSelection();
-- 
2.9.0.windows.1

Reply via email to