You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The third argument to send_message is expected to be a long (see here) not a char* and certainly not a Python string. This seems reasonable since Python doesn't use pointers anyway, so the sptr argument to Scintilla send_message is defined for those few places where a non-pointer argument is used.
You might get the Python string converted to char* and then to long using the appropriate ctypes functions and then pass that.
But note you can't pass a pointer in a long on windows 64, so its not portable anyway.
Scintilla_send_message should probably use Scintilla's typedefs uptr_t and sptr_t or GLib's guintptr and gintptr (or std C's uintptr_t/intptr_t) rather than glong/long, in order to portably fit a pointer in it.
For the z format, I'm not sure if Scintilla handles NULL arguments. I've had sometimes feeding bad args to Scintilla and it just crashes. I guess if you tested some string functions and it works, it's ok, otherwise we could do like sptr?sptr:"" or whatever.
I faced the scintilla_send_message() problem with peasy as well. I decided to not do anything about it for now (you'd need to provide a wrapper for every arg combination) but instead just rely on all necessary functionality being wrapped by Geany' sci_* functions which can be called (and may add value).
Activity
elextr commentedon Jul 16, 2015
The third argument to send_message is expected to be a long (see here) not a char* and certainly not a Python string. This seems reasonable since Python doesn't use pointers anyway, so the sptr argument to Scintilla send_message is defined for those few places where a non-pointer argument is used.
You might get the Python string converted to char* and then to long using the appropriate ctypes functions and then pass that.
But note you can't pass a pointer in a long on windows 64, so its not portable anyway.
scriptum commentedon Jul 16, 2015
Is it possible to add into geanypy another interface (maybe with same name?) which accepts python strings and does all casting inside C module?
I'm looking for any possible solution to call
SCI_AUTOCSHOWfrom python.elextr commentedon Jul 16, 2015
It probably could be done
send_text_message( message, otherarg, string)or similar.codebrainz commentedon Jul 16, 2015
Scintilla_send_messageshould probably use Scintilla's typedefsuptr_tandsptr_tor GLib'sguintptrandgintptr(or std C'suintptr_t/intptr_t) rather thanglong/long, in order to portably fit a pointer in it.scriptum commentedon Jul 16, 2015
Patch:
codebrainz commentedon Jul 16, 2015
For the
zformat, I'm not sure if Scintilla handlesNULLarguments. I've had sometimes feeding bad args to Scintilla and it just crashes. I guess if you tested some string functions and it works, it's ok, otherwise we could do likesptr?sptr:""or whatever.scriptum commentedon Jul 17, 2015
I tested on this:
Works well.
Add send_text_message
kugel- commentedon Mar 6, 2016
I faced the scintilla_send_message() problem with peasy as well. I decided to not do anything about it for now (you'd need to provide a wrapper for every arg combination) but instead just rely on all necessary functionality being wrapped by Geany' sci_* functions which can be called (and may add value).