private void Replace(string val) { var pos = sci.GetPositionFromLine(sci.CurrentLine) + lastLen; sci.ReplaceText(pos, sci.GetPositionByColumn(sci.CurrentLine, sci.GetLineEndColumn(sci.CurrentLine)), val); sci.CaretPosition = sci.GetTextLength(); }
private bool TestIfComments(int pos, bool checkStr) { var st = sci.GetStyleAt(pos); //exclude autocomplete in comments and strings var b = st == TextStyle.MultilineStyle1 || st == TextStyle.MultilineStyle2 || st == TextStyle.Style6 || st == TextStyle.Style7; if (st == TextStyle.None && checkStr) { var lnn = sci.GetLineFromPosition(pos); var ln = sci.GetLine(lnn); var col = sci.GetColumnFromPosition(pos); for (var i = col; i > -1; i--) { if (sci.CharAt(sci.GetPositionByColumn(lnn, i)) == '"') { return(true); } } } return(b); }
void ITextEditor.SelectText(int line, int col, int length) { var pos = sci.GetPositionByColumn(line, col); sci.Select(pos, length, SelectionFlags.MakeOnlySelection | SelectionFlags.ScrollToCaret); if (sci.CanSelect) { sci.Select(); } }