private void LintPanel_MouseClick(object sender, MouseEventArgs e) { if (jsonError) { try { string error = JSON_Reader.GetJSON_Error(Editor_TextBox.Text); ConsoleHandler.force_append_Notice(error); //Line number string[] split = error.Split(','); string[] line = split[split.Length - 2].Split(' '); int lineNumber = Int32.Parse(line[line.Length - 1].Replace(".", "").Replace(",", "")); //Position in line string[] pos = split[split.Length - 1].Split(' '); int linePos = Int32.Parse(pos[pos.Length - 1].Replace(".", "").Replace(",", "")); //Scroll to the line above error int index = Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 3) + linePos; Editor_TextBox.Select(index, 1); Editor_TextBox.ScrollToCaret(); int numChars = (Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 1)) - (Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 2)); //highlight line with error index = Editor_TextBox.GetFirstCharIndexFromLine(lineNumber - 2) + linePos; Editor_TextBox.Focus(); Editor_TextBox.Select(index, numChars - 2); } catch { ConsoleHandler.append_CanRepeat("Something went wrong... Unable to find the bad json"); } } }