> except that, there exist no functions in Scite that can get and set
> the clipboard via Lua strings... until now :)
http://www.scintilla.org/ScintillaDoc.html#SCI_COPYTEXT
Neil
> Oh dear - how could I have missed that !? Well, "SetClipboard" seems
> to have been a waste of work then.. :)
A problem with large APIs like Scintilla's is that its easy to
overlook things. Its one of the reasons I don't like adding
convenience methods that can be worked around in other ways.
> However, there still isn't anything that would correspond to a
> "GetClipboard", right?
There isn't currently a GetClipboard. I'm unsure about adding
GetClipboard to Scintilla. Except for some rare examples where a
particular platform really needs some help, Scintilla APIs should be
cross-platform.
CopyText was justified by some platform complexities like the
asynchronous nature of the X clipboard requiring callbacks in early
versions of GTK+. The current way of just calling
gtk_clipboard_wait_for_text is simple enough to be done by the script
if it loads a library with access to GTK+ (like LuaGnome
http://lua-gtk.luaforge.net/en/index.html).
There are some problems with the patch. There's some dead code that
looks exploratory like looping on
gtk_clipboard_wait_is_text_available. Even in the active code there is
a second call to gtk_clipboard_wait_for_text if the first returns NULL
- maybe this is really needed but if so, it at least deserves a
comment. The string returned is supposed to be freed with g_free but
its handed back to the platform-independent code in Editor which isn't
freeing it and doesn't know about g_free since that is only on GTK+.
Returning a std::string would be better.
http://library.gnome.org/devel/gtk/stable/gtk-Clipboards.html#gtk-clipboard-wait-for-text
Neil
I've used lua-gnome with GTK SciTE and it works well for putting up
custom GUI widgets as well.
Generally the approach should be:
- is there an external Lua library that could do the job? (like lua-gnome)
- can we write a Lua extension to do the job? (like the
spawner-ex.dll I use for scite-debug)
- otherwise, last resort, patch SciTE.
steve d.
> Generally the approach should be:
> - is there an external Lua library that could do the job? (like lua-gnome)
> - can we write a Lua extension to do the job? (like the
> spawner-ex.dll I use for scite-debug)
> - otherwise, last resort, patch SciTE.
>
Steve - thanks for your comments; a good checklist to have in mind!
Btw - I just thought I'd revisit this thread, because:...
* I wanted get/set clipboard because I wanted to be able to append to
clipboard
* I wanted append to clipboard, because I want to copy non-contiguous
pieces of text
... and I just discovered *now* that Scite has a multiple selection
facility - which in this respect, does the same thing for me! And even
more - since the 'additional' selection can be styled to be of
different color than the normal - so now I have an indication of what
is in the 'queue' :)
However, the 'append to clipboard' script can still be useful to me -
since I have it done to spit out the clipboard contents to output
window whenever 'append' action is performed; which can be useful to
keep track of the copying operation in view (especially if the 'non-
contiguous pieces of text' are far away, and are not in the same
view).
Well, just wanted to leave this here - sorry to bump an old thread,
Cheers!