Re: How to not convert layout when pasting?

2021-04-09 Thread Scott Kostyshak
On Fri, Apr 09, 2021 at 05:30:28PM +0200, Jean-Marc Lasgouttes wrote:
> Le 09/04/2021 à 16:58, Scott Kostyshak a écrit :
> > Just to make sure I understand, according to this copy-based mechanism,
> > suppose I have the following in an itemize paragraph:
> > 
> >* This is a paragraph.
> > 
> > If I copy just "This is", then when I paste into the empty enumerate
> > item it would not be converted to itemize and enumerate would be
> > preserved. On the other hand if I copy the full "This is a paragraph."
> > then it would be converted. Do I understand correctly? This is
> > interesting and I haven't thought about this possibility. I would have
> > to pay more attention to when this issue comes up for me. I think it
> > would cover most of the cases.
> 
> Note that the difficulty with that is that the clipboard does not keep the
> information of whether the paragraph was complete. But it could be possible
> to reset the layout in the cliboard itself at copy time.

I see. I think I like that idea, although I would need to think more and
test to be sure.

If there is interest, we could do a poll on LyX users for a couple of
use cases to see what is expected. I do not have time (and I do not know
this part of the code) to work on a patch though.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-09 Thread Jean-Marc Lasgouttes

Le 09/04/2021 à 16:58, Scott Kostyshak a écrit :

Just to make sure I understand, according to this copy-based mechanism,
suppose I have the following in an itemize paragraph:

   * This is a paragraph.

If I copy just "This is", then when I paste into the empty enumerate
item it would not be converted to itemize and enumerate would be
preserved. On the other hand if I copy the full "This is a paragraph."
then it would be converted. Do I understand correctly? This is
interesting and I haven't thought about this possibility. I would have
to pay more attention to when this issue comes up for me. I think it
would cover most of the cases.


Note that the difficulty with that is that the clipboard does not keep 
the information of whether the paragraph was complete. But it could be 
possible to reset the layout in the cliboard itself at copy time.


JMarc
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-09 Thread Scott Kostyshak
On Fri, Apr 09, 2021 at 10:13:27AM +1200, Andrew Parsloe wrote:
> On 9/04/2021 5:12 am, Enrico Forestieri wrote:
> > On Thu, Apr 08, 2021 at 12:01:29PM -0400, Scott Kostyshak wrote:
> > > Sometimes I want to copy something from an itemize environment and
> > > paste it into a new enumerate item. If I start a new enumerate item
> > > and just paste, LyX converts the layout to itemize. My workaround is
> > > to type "a" and then paste. This way, the enumerate is preserved. Then
> > > I delete the "a". I forget why I developed this habit rather than just
> > > pasting, let LyX convert to itemize, then simply convert back to
> > > enumerate. Perhaps the nesting was not fixed when I do this instead?
> > > In any case, that's not ideal either.
> > > 
> > > Do others often run into a similar situation?
> > Yes, all the time. This is really annoying. However, if you want to
> > paste only text (no insets), put the following line in you user.bind file:
> > 
> > \bind "C-M-v" "clipboard-paste-simple"
> > 
> > and then use Ctrl+Alt+V for pasting.
> 
> Thank you Enrico. This solves for me a matter that has often irritated.
> Strangely, the very first time I tried Ctrl+Alt+V, copying from itemize to
> enumerate, the bullet from the itemize environment was also copied so that
> the result looked like "1. * itemize" (where the asterisk denotes the
> itemize bullet). I've been unable to reproduce since (in 2.4.0-alpha3).

Thanks, Enrico. I think most of the time it does have insets. But this
idea does make me think about crafting a command-sequence that might
work. The following seems to do what I want:

  command-sequence bookmark-save 0; self-insert A; paste; bookmark-save 9; 
bookmark-goto 0; char-delete-backward; bookmark-goto 9

The bookmark commands are because I did not find a "paragraph-begin"
LFUN (I see only line-begin) and "paragraph-end". I started a new thread
for this.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-09 Thread Scott Kostyshak
On Thu, Apr 08, 2021 at 07:29:47PM +0200, Jean-Marc Lasgouttes wrote:
> Le 08/04/2021 à 18:01, Scott Kostyshak a écrit :
> > Sometimes I want to copy something from an itemize environment and paste it 
> > into a new enumerate item. If I start a new enumerate item and just paste, 
> > LyX converts the layout to itemize. My workaround is to type "a" and then 
> > paste. This way, the enumerate is preserved. Then I delete the "a". I 
> > forget why I developed this habit rather than just pasting, let LyX convert 
> > to itemize, then simply convert back to enumerate. Perhaps the nesting was 
> > not fixed when I do this instead? In any case, that's not ideal either.
> 
> 
> What is done in other situations is to differentiate on whether a full
> paragraph is pasted or just a fragment of a paragraph. This is the case when
> inserting an inset over a selection. Would that work for you here?

Just to make sure I understand, according to this copy-based mechanism,
suppose I have the following in an itemize paragraph:

  * This is a paragraph.

If I copy just "This is", then when I paste into the empty enumerate
item it would not be converted to itemize and enumerate would be
preserved. On the other hand if I copy the full "This is a paragraph."
then it would be converted. Do I understand correctly? This is
interesting and I haven't thought about this possibility. I would have
to pay more attention to when this issue comes up for me. I think it
would cover most of the cases.

Scott

> Otherwise the test for emptyness is explicit in the code, it is easy to
> remove. We could test whether the receiving layout is the default layout
> instead.
> 
> JMarc
> 
> -- 
> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Dr Eberhard W Lisse

I like this solution.

el
On 2021-04-08 18:24 , Kornel Benko wrote:
[...]

Maybe 2 different paste buttons?
one with 'preserve source layout'
the second with 'preserve destination layout'

Or 'middle mouse click' vs. 'Shift middle mouse click '

Kornel





--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Andrew Parsloe

On 9/04/2021 5:12 am, Enrico Forestieri wrote:

On Thu, Apr 08, 2021 at 12:01:29PM -0400, Scott Kostyshak wrote:

Sometimes I want to copy something from an itemize environment and
paste it into a new enumerate item. If I start a new enumerate item
and just paste, LyX converts the layout to itemize. My workaround is
to type "a" and then paste. This way, the enumerate is preserved. Then
I delete the "a". I forget why I developed this habit rather than just
pasting, let LyX convert to itemize, then simply convert back to
enumerate. Perhaps the nesting was not fixed when I do this instead?
In any case, that's not ideal either.

Do others often run into a similar situation?

Yes, all the time. This is really annoying. However, if you want to
paste only text (no insets), put the following line in you user.bind file:

\bind "C-M-v" "clipboard-paste-simple"

and then use Ctrl+Alt+V for pasting.


Thank you Enrico. This solves for me a matter that has often irritated. 
Strangely, the very first time I tried Ctrl+Alt+V, copying from itemize 
to enumerate, the bullet from the itemize environment was also copied so 
that the result looked like "1. * itemize" (where the asterisk denotes 
the itemize bullet). I've been unable to reproduce since (in 2.4.0-alpha3).


Andrew

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Jean-Marc Lasgouttes

Le 08/04/2021 à 18:01, Scott Kostyshak a écrit :

Sometimes I want to copy something from an itemize environment and paste it into a new enumerate 
item. If I start a new enumerate item and just paste, LyX converts the layout to itemize. My 
workaround is to type "a" and then paste. This way, the enumerate is preserved. Then I 
delete the "a". I forget why I developed this habit rather than just pasting, let LyX 
convert to itemize, then simply convert back to enumerate. Perhaps the nesting was not fixed when I 
do this instead? In any case, that's not ideal either.



What is done in other situations is to differentiate on whether a full 
paragraph is pasted or just a fragment of a paragraph. This is the case 
when inserting an inset over a selection. Would that work for you here?


Otherwise the test for emptyness is explicit in the code, it is easy to 
remove. We could test whether the receiving layout is the default layout 
instead.


JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Enrico Forestieri
On Thu, Apr 08, 2021 at 12:01:29PM -0400, Scott Kostyshak wrote:
> Sometimes I want to copy something from an itemize environment and
> paste it into a new enumerate item. If I start a new enumerate item
> and just paste, LyX converts the layout to itemize. My workaround is
> to type "a" and then paste. This way, the enumerate is preserved. Then
> I delete the "a". I forget why I developed this habit rather than just
> pasting, let LyX convert to itemize, then simply convert back to
> enumerate. Perhaps the nesting was not fixed when I do this instead?
> In any case, that's not ideal either.
> 
> Do others often run into a similar situation?

Yes, all the time. This is really annoying. However, if you want to
paste only text (no insets), put the following line in you user.bind file:

\bind "C-M-v" "clipboard-paste-simple"

and then use Ctrl+Alt+V for pasting.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Richard Kimberly Heck

On 4/8/21 12:24 PM, Kornel Benko wrote:

Am Thu, 8 Apr 2021 12:01:29 -0400
schrieb Scott Kostyshak :


Sometimes I want to copy something from an itemize environment and paste it 
into a new
enumerate item. If I start a new enumerate item and just paste, LyX converts 
the layout
to itemize. My workaround is to type "a" and then paste. This way, the 
enumerate is
preserved. Then I delete the "a". I forget why I developed this habit rather 
than just
pasting, let LyX convert to itemize, then simply convert back to enumerate. 
Perhaps the
nesting was not fixed when I do this instead? In any case, that's not ideal 
either.

Do others often run into a similar situation? Is there a ticket with ideas for 
how to
improve this? I think I remember racoon opened a ticket but I can't find it.

What is the ideal functionality for you? Perhaps we can collect a few specific 
use
cases?

Use case A:
I copy itemize and paste it into a new enumerate item. I want the enumerate to 
be
preserved.

Use case B:
I copy itemize and paste it into a new enumerate item. I want itemize.

Ideally, we would allow for the user to achieve both use case A and B without 
needing
to explicitly convert the layout. What if "Paste Special > Plain Text" (Ctrl + 
Shift +
V) pasted the text without converting the layout? I don't understand why that's
currently not the case. If I remember correctly, when the clipboard item is a 
LyX item,
Ctrl + Shift + V currently functions the same as Ctrl + V, but I'm not sure 
about that.

If for some reason Ctrl + Shift + V is not the way to go, I suppose an 
alternative is
for the user to signal their intent (between use case A and use case B) when 
*copying*.
i.e., if the user does "Ctrl + Shift + C", this could mean "copy without 
layout". Then,
the host layout dominates. I don't think I like this as much as an alternate 
paste but
perhaps I could get used to this.

Scott

Maybe 2 different paste buttons?
one with 'preserve source layout'
the second with 'preserve destination layout'

Or 'middle mouse click' vs. 'Shift middle mouse click '


It's hard to imagine a fully general solution here. It's just the first 
paragraph that's affected in such cases. I'm inclined in some ways to 
think that we should always just preserve the original layout, if it's 
being pasted into an empty paragraph. I think that's what people would 
normally expect.


Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: How to not convert layout when pasting?

2021-04-08 Thread Kornel Benko
Am Thu, 8 Apr 2021 12:01:29 -0400
schrieb Scott Kostyshak :

> Sometimes I want to copy something from an itemize environment and paste it 
> into a new
> enumerate item. If I start a new enumerate item and just paste, LyX converts 
> the layout
> to itemize. My workaround is to type "a" and then paste. This way, the 
> enumerate is
> preserved. Then I delete the "a". I forget why I developed this habit rather 
> than just
> pasting, let LyX convert to itemize, then simply convert back to enumerate. 
> Perhaps the
> nesting was not fixed when I do this instead? In any case, that's not ideal 
> either.
> 
> Do others often run into a similar situation? Is there a ticket with ideas 
> for how to
> improve this? I think I remember racoon opened a ticket but I can't find it.
> 
> What is the ideal functionality for you? Perhaps we can collect a few 
> specific use
> cases?
> 
> Use case A:
> I copy itemize and paste it into a new enumerate item. I want the enumerate 
> to be
> preserved.
> 
> Use case B:
> I copy itemize and paste it into a new enumerate item. I want itemize.
> 
> Ideally, we would allow for the user to achieve both use case A and B without 
> needing
> to explicitly convert the layout. What if "Paste Special > Plain Text" (Ctrl 
> + Shift +
> V) pasted the text without converting the layout? I don't understand why 
> that's
> currently not the case. If I remember correctly, when the clipboard item is a 
> LyX item,
> Ctrl + Shift + V currently functions the same as Ctrl + V, but I'm not sure 
> about that.
> 
> If for some reason Ctrl + Shift + V is not the way to go, I suppose an 
> alternative is
> for the user to signal their intent (between use case A and use case B) when 
> *copying*.
> i.e., if the user does "Ctrl + Shift + C", this could mean "copy without 
> layout". Then,
> the host layout dominates. I don't think I like this as much as an alternate 
> paste but
> perhaps I could get used to this.
> 
> Scott

Maybe 2 different paste buttons?
one with 'preserve source layout'
the second with 'preserve destination layout'

Or 'middle mouse click' vs. 'Shift middle mouse click '

Kornel


pgpfsr2UXmY3D.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


How to not convert layout when pasting?

2021-04-08 Thread Scott Kostyshak
Sometimes I want to copy something from an itemize environment and paste it 
into a new enumerate item. If I start a new enumerate item and just paste, LyX 
converts the layout to itemize. My workaround is to type "a" and then paste. 
This way, the enumerate is preserved. Then I delete the "a". I forget why I 
developed this habit rather than just pasting, let LyX convert to itemize, then 
simply convert back to enumerate. Perhaps the nesting was not fixed when I do 
this instead? In any case, that's not ideal either.

Do others often run into a similar situation? Is there a ticket with ideas for 
how to improve this? I think I remember racoon opened a ticket but I can't find 
it.

What is the ideal functionality for you? Perhaps we can collect a few specific 
use cases?

Use case A:
I copy itemize and paste it into a new enumerate item. I want the enumerate to 
be preserved.

Use case B:
I copy itemize and paste it into a new enumerate item. I want itemize.

Ideally, we would allow for the user to achieve both use case A and B without 
needing to explicitly convert the layout. What if "Paste Special > Plain Text" 
(Ctrl + Shift + V) pasted the text without converting the layout? I don't 
understand why that's currently not the case. If I remember correctly, when the 
clipboard item is a LyX item, Ctrl + Shift + V currently functions the same as 
Ctrl + V, but I'm not sure about that.

If for some reason Ctrl + Shift + V is not the way to go, I suppose an 
alternative is for the user to signal their intent (between use case A and use 
case B) when *copying*. i.e., if the user does "Ctrl + Shift + C", this could 
mean "copy without layout". Then, the host layout dominates. I don't think I 
like this as much as an alternate paste but perhaps I could get used to this.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel