コード例 #1
0
        public void WordFinder_GetWord()
        {
            string sLine = "\tx\t\tint,";

            int[] arrBounds = WordFinder.GetWord(sLine, 3, 4);
            Assert.AreEqual(arrBounds[0], 5);
            Assert.AreEqual(arrBounds[1], 12);
            arrBounds = WordFinder.GetWord(sLine, 0, 4);
            Assert.AreEqual(arrBounds[0], 0);
            Assert.AreEqual(arrBounds[1], 4);
        }
コード例 #2
0
 //=========================================================================================
 protected override void OnMouseDoubleClick(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (this.Viewer.Document.Count > 0)
         {
             string sLine = this.Viewer.Document[this.Caret.Line].Text;
             if (sLine.Length > 0)
             {
                 int[] arrIndexes = WordFinder.GetWord(sLine, this.Caret.Char, this.Viewer._TabSize);
                 int   iChar      = this.Caret.GetChar(sLine, arrIndexes[0]);
                 this.SelectionStart.SetPos(this.Caret.Line, arrIndexes[0], iChar);
                 this.Caret.MoveToPos(this.Caret.Line, arrIndexes[1], false);
             }
         }
         this.Invalidate(false);
     }
     base.OnMouseDoubleClick(e);
 }