Ejemplo n.º 1
0
        public void FindCurrentHitWord(out int startAt, out int len)
        {
            if (currentTextRun == null)
            {
                startAt = 0;
                len     = 0;
                return;
            }

            //
            //we read entire line
            //and send to line parser to parse a word
            StringBuilder stbuilder = new StringBuilder();

            currentLine.CopyLineContent(stbuilder);
            string lineContent = stbuilder.ToString();
            //find char at

            TextBufferSpan   textBufferSpan = new TextBufferSpan(lineContent.ToCharArray());
            ILineSegmentList segmentList    = this.Root.TextServices.BreakToLineSegments(ref textBufferSpan);

            if (segmentList != null)
            {
                int segcount = segmentList.Count;
                for (int i = 0; i < segcount; ++i)
                {
                    ILineSegment seg = segmentList[i];
                    if (seg.StartAt + seg.Length >= caret_char_index)
                    {
                        //stop at this segment
                        startAt = seg.StartAt;
                        len     = seg.Length;
                        return;
                    }
                }
            }
            else
            {
                //TODO: review here
                //this is a bug!!!
            }
            //?
            startAt = 0;
            len     = 0;
        }
Ejemplo n.º 2
0
 public static void InnerCopyLineContent(EditableTextLine line, StringBuilder stBuilder)
 {
     line.CopyLineContent(stBuilder);
 }
Ejemplo n.º 3
0
 public void CopyLineContent(StringBuilder stBuilder)
 {
     currentLine.CopyLineContent(stBuilder);
 }