コード例 #1
0
        /// <summary>
        /// Gets the start visual column from the specified text line.
        /// </summary>
        public int GetTextLineVisualStartColumn(TextLine textLine)
        {
            if (!TextLines.Contains(textLine))
            {
                throw new ArgumentException("textLine is not a line in this VisualLine");
            }

            return(TextLines.TakeWhile(tl => tl != textLine).Sum(tl => tl.Length));
        }
コード例 #2
0
ファイル: VisualLine.cs プロジェクト: ishani/Oddity
        /// <summary>
        /// Gets the start visual column from the specified text line.
        /// </summary>
        public int GetTextLineVisualStartColumn(TextLine textLine)
        {
            if (!TextLines.Contains(textLine))
            {
                throw new ArgumentException("textLine is not a line in this VisualLine");
            }
            int col = 0;

            foreach (TextLine tl in TextLines)
            {
                if (tl == textLine)
                {
                    break;
                }
                else
                {
                    col += tl.Length;
                }
            }
            return(col);
        }