Add bracket on new line

Topics: Developer Forum
Jul 18, 2014 at 7:09 PM

Been trying to this but struggling, I have the following code:
        private void scintilla1_CharAdded(object sender, ScintillaNET.CharAddedEventArgs e)
            ScintillaNET.Scintilla editor = sender as ScintillaNET.Scintilla;
            caretpos = editor.Caret.Position;
            if (e.Ch == '{')
What I am trying to do is when the user press enter the brackets will format correctly, any ideas on how to achieve this? its similar to what Visual Studio does when inserting bracket "{".
Jul 19, 2014 at 6:28 PM
Is your question how to place the closing brace on a new line instead of on the same line? In that case, just add a newline character before your brace character in the inserted text: