User forums > Nightly builds
The 11 February 2008 build (4872) is out.
thomas:
--- Quote from: sika on February 13, 2008, 01:53:30 pm ---Is there some news for bug #11505 (https://developer.berlios.de/bugs/?func=detailbug&bug_id=11505&group_id=5358)?
Thanks
--- End quote ---
That's not a bug, but a feature request :) Regarding news to this feature, there are no recent news.
I implemented that feature inside Code::Blocks on 2006-10-02. It was explicitely disabled under GTK two weeks later, since users reported that the operating system already implements the functionality, and doubling it in the application would paste all text twice (which of course doesn't make sense).
Pecan:
--- Quote from: sika on February 13, 2008, 01:53:30 pm ---Is there some news for bug #11505 (https://developer.berlios.de/bugs/?func=detailbug&bug_id=11505&group_id=5358)?
Thanks
--- End quote ---
The following url contains a zip file.
http://www.savefile.com/files/1379067
The zip file MouseSap.zip contains a plugin to implement the "OnGPM" (middle mouse paste) as a plugin for both MSW and Linux.
Download the zip file, and expand it. From the CodeBlocks "Menu/Plugins/Manage Plugins/Install New" dialog, navigate to either libMouseSap.cbplugin (for linux), or MouseSap.cbplugin for MSW.
The plugin pastes the last text selection at the current cursor position.
One difference from the current implementation in MSW. It re-selects the pasted text at the target cursor position. I find this behavior more comfortable than the jump backward to the original selection caused by not re-marking the selection.
Let me know how it works for you.
sika:
Thanks for the plugin!
I didn't know it had been implemented in 2006.
Honestly, on linux this is quite a standard feature. I haven't seen many apps having the same problem. That's why I call it a bug :).
I'll try to summarize the situation (this is under linux, I can't test under win32 (I thought this feature was specific to linux)):
CB without plugin:
-copy text outside CB, paste inside CB -> works (so this is done by the operating system?)
-copy text inside CB, paste inside CB -> doesn't work
-copy text inside CB, paste outside CB -> doesn't work
CB with the plugin:
-copy text outside CB, paste inside CB -> doesn't work
-copy text inside CB, paste inside CB -> works (well as you stated, the pasted text is selected. In other apps the cursor is placed after the pasted text or the original text is selected. I don't know what is the best behavior.)
-copy text inside CB, paste outside CB -> doesn't work
The odd thing is everything work just fine with the text in the "messages" frame (in the build log for example).
EDIT: there was a mistake
thomas:
The text areas in the messages panel are native controls. Therefore, the OS does everything, we don't even know.
The editor is not a native control, which makes things more complicated. What the "GPM hack" in Code::Blocks does is simply insert the current selection (if any) at the clicked location. It does not modify the contents of the clipboard, nor look at it. It's not perfect, but it offers at least some of the functionality.
One reason why we don't touch the clipboard is that the feature was meant to be present under Windows, too, which would be perceived as disturbing behaviour for Windows users. Also, to fully simulate GPM, more drastic things have to happen. Pasting into Code::Blocks is trivial, we can just read from the clipboard. However, the opposite direction is a lot more complicated. We cannot know that the user is going to middle-click another window the next instant, and when it happens, it's too late already. This means that we have to export the current selection to the clipboard every time the application loses focus, just in case. Gulp. No thank you :)
Surprisingly, some users reported shortly after this feature was implemented that they were now getting double-inserts. I didn't see how this could have been possible, but had to believe them (hey... why should they lie?). So, the feature was disabled under Linux. Anything you see under Linux is plainly the operating system's doing.
Funnily, from your description, Pecan's plugin seems to actually make it worse, as pasting into Code::Blocks from outside doesn't work any more while it would before... so you can see that something is going on there from the operating system's side. I have no idea what messes up the copy from outside functionality, though.
The best thing may be to not touch anything, and let the OS do whatever it does :?
Pecan:
--- Quote from: sika on February 14, 2008, 10:02:42 am ---...
CB with the plugin:
-copy text outside CB, paste inside CB -> doesn't work
-copy text inside CB, paste inside CB -> works (well as you stated, the pasted text is selected. In other apps the cursor is placed after the pasted text or the original text is selected. I don't know what is the best behavior.)
-copy text inside CB, paste outside CB -> doesn't work
...
--- End quote ---
The first "doesn't work" is easy to fix. If there is no selection in the current editor, we can paste from the clipboard.
The second "doesn't work" is bad behavior from an MSW point of view, because I don't think the user expects "selected text" to clobber the clipboard unless they do a specific ctrl-c etc.
However, on Linux, it might be done, somewhat like Scintilla does it for gtk.
--- Code: ---#ifdef __WXGTK__
void ScintillaWX::DoMiddleButtonUp(Point pt) {
// Set the current position to the mouse click point and
// then paste in the PRIMARY selection, if any. wxGTK only.
int newPos = PositionFromLocation(pt);
MovePositionTo(newPos, noSel, true);
pdoc->BeginUndoAction();
wxTextDataObject data;
bool gotData = false;
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(true);
gotData = wxTheClipboard->GetData(data);
wxTheClipboard->UsePrimarySelection(false);
wxTheClipboard->Close();
}
if (gotData) {
wxString text = wxTextBuffer::Translate(data.GetText(),
wxConvertEOLMode(pdoc->eolMode));
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
int len = strlen(buf);
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
pdoc->EndUndoAction();
NotifyChange();
Redraw();
ShowCaretAtCurrentPosition();
EnsureCaretVisible();
}
#else
void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
}
#endif
--- End code ---
Strangely, I do not see this implemented on my Ubuntu 7.10 system. There must be some option I cannot find.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version