9 #define PY_SSIZE_T_CLEAN
46 ".. method:: region_as_string(range=None)\n"
48 " :arg range: The region of text to be returned, "
49 "defaulting to the selection when no range is passed.\n"
50 " Each int pair represents a line and column: "
51 "((start_line, start_column), (end_line, end_column))\n"
52 " The values match Python's slicing logic "
53 "(negative values count backwards from the end, the end value is not inclusive).\n"
54 " :type range: Two pairs of ints\n"
55 " :return: The specified region as a string.\n"
65 static const char *_keywords[] = {
"range",
NULL};
66 static _PyArg_Parser _parser = {
73 if (!_PyArg_ParseTupleAndKeywordsFast(
74 args, kwds, &_parser, ®ion.
curl, ®ion.
curc, ®ion.
sell, ®ion.
selc)) {
78 if (PyDict_GET_SIZE(kwds) > 0) {
84 return PyUnicode_FromString(
"");
87 PyObject *sel_text = PyUnicode_FromString(buf);
96 METH_VARARGS | METH_KEYWORDS,
97 bpy_rna_region_as_string_doc,
101 ".. method:: region_from_string(body, range=None)\n"
103 " :arg body: The text to be inserted.\n"
105 " :arg range: The region of text to be returned, "
106 "defaulting to the selection when no range is passed.\n"
107 " Each int pair represents a line and column: "
108 "((start_line, start_column), (end_line, end_column))\n"
109 " The values match Python's slicing logic "
110 "(negative values count backwards from the end, the end value is not inclusive).\n"
111 " :type range: Two pairs of ints\n");
122 static const char *_keywords[] = {
"",
"range",
NULL};
123 static _PyArg_Parser _parser = {
127 ":region_from_string",
131 if (!_PyArg_ParseTupleAndKeywordsFast(args,
143 if (PyDict_GET_SIZE(kwds) > 0) {
156 "region_from_string",
158 METH_VARARGS | METH_KEYWORDS,
159 bpy_rna_region_from_string_doc,
bool txt_has_sel(const struct Text *text)
void txt_sel_set(struct Text *text, int startl, int startc, int endl, int endc)
char * txt_sel_to_buf(struct Text *text, size_t *r_buf_strlen)
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len) ATTR_NONNULL(1
Read Guarded memory(de)allocation.
PyDoc_STRVAR(bpy_rna_region_as_string_doc, ".. method:: region_as_string(range=None)\n" "\n" " :arg range: The region of text to be returned, " "defaulting to the selection when no range is passed.\n" " Each int pair represents a line and column: " "((start_line, start_column), (end_line, end_column))\n" " The values match Python's slicing logic " "(negative values count backwards from the end, the end value is not inclusive).\n" " :type range: Two pairs of ints\n" " :return: The specified region as a string.\n" " :rtype: str.\n")
struct TextRegion TextRegion
PyMethodDef BPY_rna_region_from_string_method_def
PyMethodDef BPY_rna_region_as_string_method_def
static PyObject * bpy_rna_region_from_string(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject * bpy_rna_region_as_string(PyObject *self, PyObject *args, PyObject *kwds)
void(* MEM_freeN)(void *vmemh)
PyObject_HEAD PointerRNA ptr
void WM_main_add_notifier(unsigned int type, void *reference)