Discussion:
creating lyx note causes clipboard copy
(too old to reply)
Liviu Andronic
2010-12-29 09:22:46 UTC
Permalink
Perhaps creation of the note inset could save and then restore the clipboard
state? The bug is even more annoying if the clipboard contents come not from LyX
but from some other application. Creation of a note inset may cause data loss.
Not if you use a clipboard manager. If on Linux look into
xfce4-clipman, or similar [1].
Liviu

[1] http://alternativeto.net/software/clipman/
Georg Baum
2011-01-05 20:47:41 UTC
Permalink
1. Create a new document.
2. Type in two words, word1 and word2.
3. Select and copy word2.
4. Highlight word1 and Insert, Note, LyX Note. word1 will be placed
inside a new note.
5. Paste.
Expected: paste outputs word2, as copied in (3)
Actual: paste outputs word1, from (4)
iirc this is because inserting word1 into the note inset (4) is actually
done via clipboard.
As a linux user, when I mark something, I expect it to be in the
clipboard already - because I marked it. (In linux, you don't need to
* select word2, putting it on the clipboard
* redundant "copy"
* select word1, putting it on the clipboard replacing word2
* Insert Note
* Paste, and get word1 which is still on the clipboard as it is still
selected.
You are confusing selection and clipboard (as do all X11 "clipboard
managers" I know). The selection is filled automatically and can be pasted
with middle mouse button, and the clipboard is only filled by explicit user
request (C-C) and can be pasted with C-V. So, what you describe above is not
the clipboard, but basically the selection (modulo the 'redundant "copy"').
Unfortunately, some other systems wants to do this the harder way. In
that case, the behavior is a mild bug. The users do not expect the
clipboard to be involved - unless they involve it explicitly. Please
don't add code to "save" the system clipboard state to fix this.
Well, saving and resetting the clipboard would be one possible way to fix
this bug. I agree that the selection should continue to work as it does, and
it should indeed contain the note contents after inserting the note, but the
clipboard should definitely not be altered by this operation.


Georg
Helge Hafting
2011-01-07 10:00:52 UTC
Permalink
Post by Georg Baum
1. Create a new document.
2. Type in two words, word1 and word2.
3. Select and copy word2.
4. Highlight word1 and Insert, Note, LyX Note. word1 will be placed
inside a new note.
5. Paste.
Expected: paste outputs word2, as copied in (3)
Actual: paste outputs word1, from (4)
iirc this is because inserting word1 into the note inset (4) is actually
done via clipboard.
As a linux user, when I mark something, I expect it to be in the
clipboard already - because I marked it. (In linux, you don't need to
* select word2, putting it on the clipboard
* redundant "copy"
* select word1, putting it on the clipboard replacing word2
* Insert Note
* Paste, and get word1 which is still on the clipboard as it is still
selected.
You are confusing selection and clipboard (as do all X11 "clipboard
managers" I know).
Thanks for clearing that up.
Post by Georg Baum
Well, saving and resetting the clipboard would be one possible way to fix
this bug.
It would, but it also causes LyX to do extra work. Compare:

1. My approach
a. Save selection in some temporary storage,
b. insert box/note/whatever
c. re-insert selection inside box/note

2. The clipboard approach
a. Save the clipboard to temporary storage
b. Move selection to clipboard
c. insert box/note/whatever
d. paste clipboard into box/note
e. reinstate clipboard from temporary storage

The clipboard approach *may* be easier to program because of existing
code to access the system clipboard. But it does more work, and who
knows how big the contents of the clipboard may be? There could be
something really big there - some other app might cut/paste big images
or uncompressed video files.

In some cases, the first approach might be possible without moving data
to temporary storage at all - i.e. allocate a box/note, move selection
from the LyX buffer into the box/note, then insert the box/note with
content into LyX.

Helge Hafting

Vincent van Ravesteijn
2011-01-03 11:52:52 UTC
Permalink
As a linux user, when I mark something, I expect it to be in the clipboard
already - because I marked it. (In linux, you don't need to "copy". This
* select word2, putting it on the clipboard
* redundant "copy"
* select word1, putting it on the clipboard replacing word2
* Insert Note
* Paste, and get word1 which is still on the clipboard as it is still
 selected.
Unfortunately, some other systems wants to do this the harder way. In that
case, the behavior is a mild bug. The users do not expect the clipboard to
be involved - unless they involve it explicitly. Please don't add code to
"save" the system clipboard state to fix this. Consider instead some sort of
"LyX-internal" clipboard that the code can use when inserting a box (or just
about anything else) around a piece of text. The user should never see this
internal clipboard, it'd be for internal transformations only.
Please add this to bug #6570 (http://www.lyx.org/trac/ticket/6570) so
someone will remember when he/she tries to fix this.

Vincent
Helge Hafting
2011-01-03 10:29:58 UTC
Permalink
1. Create a new document.
2. Type in two words, word1 and word2.
3. Select and copy word2.
4. Highlight word1 and Insert, Note, LyX Note. word1 will be placed inside
a new note.
5. Paste.
Expected: paste outputs word2, as copied in (3)
Actual: paste outputs word1, from (4)
iirc this is because inserting word1 into the note inset (4) is actually done via clipboard.
As a linux user, when I mark something, I expect it to be in the
clipboard already - because I marked it. (In linux, you don't need to
"copy". This saves keypresses.) With this model, LyX is correct:
* select word2, putting it on the clipboard
* redundant "copy"
* select word1, putting it on the clipboard replacing word2
* Insert Note
* Paste, and get word1 which is still on the clipboard as it is still
selected.

Unfortunately, some other systems wants to do this the harder way. In
that case, the behavior is a mild bug. The users do not expect the
clipboard to be involved - unless they involve it explicitly. Please
don't add code to "save" the system clipboard state to fix this.
Consider instead some sort of "LyX-internal" clipboard that the code can
use when inserting a box (or just about anything else) around a piece of
text. The user should never see this internal clipboard, it'd be for
internal transformations only.

Helge Hafting
Loading...