Favicon

[patch] Bug 3625

http://bugzilla.lyx.org/show_bug.cgi?id=3625

Bug 3625 is about the fact that you can't copy text with leading spaces.
Ironically this is actively disabled by the following lines:

CutAndPaste.cpp:715-722
// copy behind a space if there is one
...
while (pos < pars[par].size() &&
       pars[par].isLineSeparator(pos) &&
       (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
            ++pos;

Why do we want to start copying text after a space ? Well, removing
these lines solves the bug.

In Buffer::insertStringAsLines we can allow leading spaces from other
applications by initializing the space_inserted variable differently.

Vincent
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp	(revision 26708)
+++ src/Buffer.cpp	(working copy)
@@ -593,8 +593,8 @@
 {
 	Font font = fn;
 
(Continue reading)

Uwe Stöhr | 5 Oct 22:22

Re: [patch] Bug 3625

 > http://bugzilla.lyx.org/show_bug.cgi?id=3625
 >
 > Bug 3625 is about the fact that you can't copy text with leading spaces.
 > Ironically this is actively disabled by...
 > Why do we want to start copying text after a space?

I think that was once introduced to avoid multiple spaces after pasting to normal text area.

 > Well, removing these lines solves the bug.

Indeed.

Before I put this in, I want to hear the opinion of others.

regards Uwe

Favicon

Re: [patch] Bug 3625

On Sun, 2008-10-05 at 22:23 +0200, Uwe Stöhr wrote:
> 
>  > http://bugzilla.lyx.org/show_bug.cgi?id=3625
>  >
>  > Bug 3625 is about the fact that you can't copy text with leading
> spaces.
>  > Ironically this is actively disabled by...
>  > Why do we want to start copying text after a space?
> 
> I think that was once introduced to avoid multiple spaces after
> pasting to normal text area.

I cannot get multiple spaces with copy-paste within LyX. For pasting
text from the clipboard this might indeed be a problem. 

OTOH, there are more related problems with pasting:
- I can create a document with multiple "start appendices" (bug 5196),
- I can copy tabs and multiple spaces from a free-spacing env.
- I can copy several types of Insets into a Listing, while this ain't
possible with the Insert Menu...

In sum, I think it is rather strange to make an exception for leading
space. Moreover, a better, more complete solution is required anyway.

> 
> Before I put this in, I want to hear the opinion of others.

Me too.
> 
> regards Uwe
(Continue reading)

Favicon

Re: [patch] Bug 3625

Vincent van Ravesteijn <V.F.vanRavesteijn@...> writes:
> In sum, I think it is rather strange to make an exception for leading
> space. Moreover, a better, more complete solution is required anyway.

As I wrote in the bug, this is ancient code that should IMO be removed.
We have a lot of code doing special treatment for leading spaces, and
this code does not make much sense IMO.

JMarc


Gmane