This adds the ability to retrieve text selection as string.
Extending the capabilities of blender's text editor through python often requires getting the current selection as string.
Although this can be done (inelegantly) from python, this patch adds a simpler way of doing so.
Internal operators use txt_sel_to_buf in text.c for getting selection.
This patch wraps the same function and makes the value accessible from python.
What's being added
- Returns a string concatenation from current selection, separated by a newline char
- Getter function rna_Text_selected_text_get
- Length function rna_Text_selected_text_length
- Property is called selected_text, but open for other suggestions.
- Only getter and length added. Overwriting selection can be done using Text.write().