Beispiel #1
0
        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);
        }
Beispiel #2
0
        protected void Cut()
        {
            var sel = sci.GetSelection();
            var sl  = sci.GetLineFromPosition(sel.Start);

            if (sl != sci.LineCount - 1 || sci.GetColumnFromPosition(sel.Start) > lastLen)
            {
                sci.Copy();
            }
            else
            {
                sci.Cut();
            }
        }
Beispiel #3
0
        private void AddTask(ScintillaControl sci, TreeNode parent, TaskItem task)
        {
            var txt = sci.GetTextRangeUnicode(task.Position, task.Position + task.Length).Trim(':', '-', '.', ' ', '\r', '\n');

            txt = !String.IsNullOrEmpty(txt) && txt.Length > 30 ? txt.Substring(0, 30) + "..." : txt;
            var tn = new TreeNode(String.Format("{0}: {1} ({2},{3})", task.Type.ToString().ToUpper(), txt,
                                                sci.GetLineFromPosition(task.Position) + 1, sci.GetColumnFromPosition(task.Position) + 1));

            tn.ImageKey = tn.SelectedImageKey = "Task";
            tn.Tag      = task;
            parent.Nodes.Add(tn);
        }