This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Scintilla_InsertCheck(object sender, InsertCheckEventArgs e) | |
{ | |
if ((e.Text.EndsWith("" + Constants.vbCr) || e.Text.EndsWith("" + Constants.vbLf))) { | |
int startPos = Scintilla.Lines(Scintilla.LineFromPosition(Scintilla.CurrentPosition)).Position; | |
int endPos = e.Position; | |
string curLineText = Scintilla.GetTextRange(startPos, (endPos - startPos)); //Text until the caret so that the whitespace is always equal in every line. | |
Match indent = Regex.Match(curLineText, "^[ \\t]*"); | |
e.Text = (e.Text + indent.Value); | |
if (Regex.IsMatch(curLineText, "{\\s*$")) { |