0
$\begingroup$

Currently you can select a line with the select_line command. The problem is that you select the complete line, with the indentations.

I'd like to know how I can select only the words of the current line, to integrate it in a pie please.

$\endgroup$
  • 2
    $\begingroup$ It would be better if you had posted the relevant code along with the question. In case you have the selected line in a string call string.lstrip() to get rid of the leading whitespace. $\endgroup$ – stacker Jul 7 '15 at 15:11
2
$\begingroup$
def execute(self, context):

    bpy.ops.text.move(type='LINE_BEGIN')
    bpy.ops.text.move(type='NEXT_WORD')
    bpy.ops.text.move_select(type='LINE_END')
    return {'FINISHED'}

This selects whitespace at the end of the line.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.