Menu

#1146 opening brakets, then delete

None
open
nobody
None
1
2017-12-30
2016-10-18
Anonymous
No

If you start opening a paranthesis (for instance), then the auto-completion closes it (great).
Now, if the paranthesis was a mistake, and you delete it right away, the closing one stays... it would be better to delete it as well

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2016-10-18

    Ticket moved from /p/texstudio/bugs/1940/

     
  • scorleo

    scorleo - 2017-12-30

    I wrote a macro for this. https://tex.stackexchange.com/a/408055/117534

    %SCRIPT
    previousChar = function() {return String.fromCharCode(cursor.previousChar())};
    nextChar = function() {return String.fromCharCode(cursor.nextChar())};
    var Obrackets = ['(','[','{'];
    var Cbrackets = [')',']','}'];
    var Omatch = Obrackets.indexOf(previousChar());
    var Cmatch = Cbrackets.indexOf(nextChar());
    if(Omatch>=0 && Cmatch==Omatch){
        cursor.deleteChar();
    }
    if(cursor.hasSelection()){
        cursor.removeSelectedText();
    } else {
        cursor.deletePreviousChar();
    }
    

    Map this to the Backspace key.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB