Deler
Deler

Reputation: 51

TeXstudio macro script : how to move the cursor to specified position?

For example, I want to write the following macro in script in TeXstudio(using QtScript):

%SCRIPT   
editor.write("\\textcolor{red}{}")

After invoking this macro, I want the cursor to move into the second pair of curly braces automatically. How can I modify my code to achieve the desired effect?

Upvotes: 1

Views: 560

Answers (1)

%SCRIPT
txt = "\\textcolor{red}{}"
cursor.insertText(txt)
cursor.movePosition(1,cursorEnums.Left)

Upvotes: 1

Related Questions