On 05. jan. 2011 21:47, Georg Baum wrote:
Helge Hafting wrote:

On 28. des. 2010 23:22, Pavel Sanda wrote:
Jack Tanner wrote:
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.

You are confusing selection and clipboard (as do all X11 "clipboard
managers" I know).
Thanks for clearing that up.

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

Reply via email to