0

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
0

I found mistakes! This is the working script. Of course, any suggestion is well accepted!

do{
cursor.deleteChar();
nextChar = String.fromCharCode(cursor.nextChar());
}while(nextChar!='}'&&!(cursor.atLineEnd()));
cursor.deleteChar();

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.