# Delete all characters from cursor to } with TeXStudio Script

I'd like to write a script that deletes all characters between cursor position and '}' character or the end of line.

Just an example (_ is the position of cursor):

\section{hello}_\label{hello} %comment

becomes

\section{hello} %comment

I tried this code:

%SCRIPT
do {
cursor.deleteChar();
}
while (cursor.nextChar()!='}'||!cursor.atLineEnd() )


but TeXStudio stops working!

• I think that the algorithm is correct but there are some mistakes in the code. – JBach Jul 1 at 10:52

do{