-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Peasy segfaults python3 based plugin #4
Comments
scintilla_send_message can be used directly, but only for integer arguments unfortunately. For messages taking strings or other pointers we have work around. I think adding an override (see api/Geany.py ) could work
|
@kugel- actually I tried scintilla_send_message with https://docs.python.org/3/library/ctypes.html. I couldnot find |
I suggest you run geany in gdb, breaking in scintilla_send_message (perhaps with the condition set to your message id), and verify that the pointer is passed correctly. Also, I'm confused. https://github.com/sagarchalise/geany-pyjedi is a C plugin isn't it? |
@kugel- yeah but if it does what I am trying to do, I would rather port it to peasy. I have those codes locally but since they are not working have not pushed them to github. Maybe I will push them to peasy branch in the same repo. The pyjedi |
Well, either you debug this or give me enough information so that I can try it locally. Perhaps give me your plugin or a reduced example case so that I can reproduce it on my side. |
I succesfully tried the following in the python terminal that is shipped with peasy (do you have discovered that already?). I've got the autocompletion list. Does that help you? import ctypes
from ctypes import *
sci = Geany.Document.get_current().editor.sci
list = c_char_p("foo\nbar".encode("utf8"))
# cast to get the pointer value as int
list_p = cast(list, c_void_p).value
sci.send_message(GeanyScintilla.SCI_AUTOCSHOW, 0, list_p) Closing with |
@kugel- thanks I am giving it a try. I have just one question since python strings are unicodes can I use Also, the other issue I posted is not really working. I cannot get plugins to show from Also I get |
@kugel- thanks I am giving it a try. I have just one question since
python strings are unicodes can I use `c_wchar_p` on strings rather
than `c_char_p`?
Geany and scintilla work with utf8 internally, so you have to pass such a string. wchar_t is either utf16 or utf32.
You can use Python to convert between those, though, if you need wchar_t.
BTW, if this works out for you I would be interested in adding overrides to peasy so that known scintilla messages work out of the box.
Also, the other issue I posted is not really working.
let's keep the issues separate please.
|
Seems to work.. thanks. |
This may be due to my limited understanding of C programming but I have a plugin that uses python3 directly. https://github.com/sagarchalise/geany-pyjedi
What it basically does is gives autocompletion feature based on
jedi
module rather than tags that geany originally does.But if I try to use it with peasy enabled it gives me segfault.
P.S. Actually, if scintilla_send_message can be directly used then I may port this workflow to peasy. But I couldnot get it working and according to this discussion it may be quite difficult: codebrainz/geanypy#32
The text was updated successfully, but these errors were encountered: