Skip to content

Commit 0ed9072

Browse files
committed
Add send_text_message
Geany crashes if Python string passed to SSM. Use this function if last argument of SSM is string.
1 parent 019422f commit 0ed9072

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/geanypy-scintilla.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,26 @@ Scintilla_send_message(Scintilla *self, PyObject *args, PyObject *kwargs)
779779
}
780780

781781

782+
static PyObject *
783+
Scintilla_send_text_message(Scintilla *self, PyObject *args, PyObject *kwargs)
784+
{
785+
gint msg;
786+
glong uptr = 0, ret;
787+
const char *sptr = NULL;
788+
static gchar *kwlist[] = { "msg", "lparam", "wparam", NULL };
789+
790+
SCI_RET_IF_FAIL(self);
791+
792+
if (PyArg_ParseTupleAndKeywords(args, kwargs, "i|lz", kwlist, &msg, &uptr, &sptr))
793+
{
794+
ret = scintilla_send_message(self->sci, msg, uptr, sptr);
795+
return Py_BuildValue("l", ret);
796+
}
797+
798+
Py_RETURN_NONE;
799+
}
800+
801+
782802
static PyMethodDef Scintilla_methods[] = {
783803
{ "delete_marker_at_line", (PyCFunction) Scintilla_delete_marker_at_line, METH_KEYWORDS,
784804
"Deletes a line marker." },
@@ -873,6 +893,8 @@ static PyMethodDef Scintilla_methods[] = {
873893
"Begins grouping a set of edits together as one Undo action." },
874894
{ "send_message", (PyCFunction) Scintilla_send_message, METH_KEYWORDS,
875895
"Send a message to the Scintilla widget." },
896+
{ "send_text_message", (PyCFunction) Scintilla_send_text_message, METH_KEYWORDS,
897+
"Send a text message to the Scintilla widget." },
876898
{ NULL }
877899
};
878900

0 commit comments

Comments
 (0)