Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_text_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_text_api.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c
index bcaa693524c..211f1bce442 100644
--- a/source/blender/makesrna/intern/rna_text_api.c
+++ b/source/blender/makesrna/intern/rna_text_api.c
@@ -52,6 +52,12 @@ static void rna_Text_select_set(Text *text, int startl, int startc, int endl, in
WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
}
+static void rna_Text_cursor_set(Text *text, int line, int ch, bool select)
+{
+ txt_move_to(text, line, ch, select);
+ WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
+}
+
#else
void RNA_api_text(StructRNA *srna)
@@ -87,6 +93,13 @@ void RNA_api_text(StructRNA *srna)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_int(func, "char_end", 0, INT_MIN, INT_MAX, "End Character", "", INT_MIN, INT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "cursor_set", "rna_Text_cursor_set");
+ RNA_def_function_ui_description(func, "Set cursor by line and (optionally) character index");
+ parm = RNA_def_int(func, "line", 0, 0, INT_MAX, "Line", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "char", 0, 0, INT_MAX, "Character", "", 0, INT_MAX);
+ RNA_def_boolean(func, "select", false, "", "Select when moving the cursor");
}
#endif