Menu

#519 Deleting paired brackets with one action

none
closed-works-for-me
nobody
None
5
2017-11-03
2016-07-06
Metotron
No

It would be good to have an action to delete pair brackets at once.
For excample, if I have a code {zzz = 'aaa';} and want to delete '}', paired bracket '{' deletes automatically wherever it place. And it wold be good twice if indent level will decrease with it.

Discussion

  • Skeeve

    Skeeve - 2017-10-28

    It's a simple macro:

    textArea.selectBlock();
    textArea.backspace();
    
     
    • Metotron

      Metotron - 2017-10-31

      I meen not to delete whole text, but only brackets. "Unbracket" text.

       
      • Skeeve

        Skeeve - 2017-10-31

        Try this:

        os=textArea.getSelection();
        om=textArea.isMultipleSelectionEnabled();
        if (om) {
            textArea.toggleMultipleSelectionEnabled();
        }
        oc=textArea.getCaretPosition();
        textArea.selectBlock();
        b=textArea.getSelection(0);
        textArea.selectNone();
        bs=b.getStart();
        be=b.getEnd();
        textArea.setCaretPosition(be);
        textArea.backspace();
        textArea.setCaretPosition(bs);
        textArea.delete();
        textArea.setCaretPosition(oc-1);
        if (om) {
            textArea.toggleMultipleSelectionEnabled();
        }
        textArea.setSelection(os);
        
         
        • Metotron

          Metotron - 2017-11-03

          Thank you!
          Have you a manual for this api? I want to try to expand this on quotes.

           
  • Alan Ezust

    Alan Ezust - 2017-10-31
    • status: open --> closed-works-for-me
     
  • Alan Ezust

    Alan Ezust - 2017-10-31

    Use the FirstMate Plugin.

     
  • Roman Tsourick

    Roman Tsourick - 2017-11-03

    This would be very useful, but FirstMate does not do that actually. It makes a new pair but does not remove it. If I did not miss something, the feature could be implemented in the FirstMate plugin, so the request should be made for the plugin, I think.

     

Log in to post a comment.