Bug 32572 - Middle paste into a ScPostIt also pastes into the cell behind it
Summary: Middle paste into a ScPostIt also pastes into the cell behind it
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.0 RC1
Hardware: Other All
: medium normal
Assignee: Kohei Yoshida
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-22 04:57 UTC by Caolán McNamara
Modified: 2013-11-23 13:18 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
avoid a double paste (1.02 KB, text/plain)
2010-12-22 04:57 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caolán McNamara 2010-12-22 04:57:36 UTC
Created attachment 41370 [details]
avoid a double paste

The setup for this can be found at
https://bugzilla.redhat.com/show_bug.cgi?id=663724

Fundamentally if you middle click to paste into an active comment in calc, then it also pastes into the cell behind the postit.

If you then fiddle with undo and and undo the insertion of the comment the comment indicator doesn't disappear and view->comment will blow up calc.

Best thing I guess is to not double paste. The attached attempts to do that and works for me at least. There might be a more elegant way to do this ?
Comment 1 Kohei Yoshida 2010-12-22 07:26:38 UTC
Wow.  Very interesting corner case. :-)

I also discovered that (while trying to reproduce this), middle-clicking while a cell comment is selected pastes a copy of that selected comment object, and all sorts of interesting things start to happen.  I guess we should disable duplicating cell comment objects via middle-click too while we are at it.
Comment 2 Kohei Yoshida 2010-12-22 08:43:44 UTC
The patch looks good.  That's what I would've done too.

The only thing I'm not sure is bEEMouse = TRUE.  Unless there is a specific reason for setting this, I would remove it.  It looks like this boolean flag is used in case we need to handle mouse events inside the edit engine instance (?).  In this particular case since we are ignoring this event completely, I'd say let's leave the flag alone.
Comment 3 Kohei Yoshida 2010-12-22 08:48:26 UTC
Ah, bEEMouse *is* required to skip the paste into cell!  Interesting...
Comment 4 Kohei Yoshida 2010-12-22 09:08:04 UTC
I prefer to have this handled in ScGridWindow::PasteSelection().  I feel that's more appropriate place.

But I think a better solution is to have the note object somehow tell the grid window instance that it has already handled the paste, or not even send the event to the grid window.  I don't know if that's possible or not...  Let me look into that.
Comment 5 Kohei Yoshida 2010-12-22 09:20:20 UTC
Actually the active note object isn't always associated with the current cell cursor position.  So, we need to change how we determine the active note object underneath the mouse cursor.
Comment 6 Kohei Yoshida 2010-12-22 09:35:21 UTC
Fixed on master.  This is what I ended up committing:

http://cgit.freedesktop.org/libreoffice/calc/commit/?id=342f3cfe6f2b27ea62bd9883e16014c188276356