Exemple #1
0
        private TextPosition GetWordEndPosition(
            LineInfo currentLine,
            ITextBlock currentBlock)
        {
            TextBoxViewElement viewElement = this.textBoxElement.ViewElement;
            bool       flag1 = TextBoxWrapPanel.IsTabOrWhitespace(currentBlock.Text);
            bool       flag2 = false;
            ITextBlock child;

            for (; currentBlock.Index < viewElement.Children.Count - 1; currentBlock = child)
            {
                child = viewElement.Children[currentBlock.Index + 1] as ITextBlock;
                bool flag3 = TextBoxWrapPanel.IsTabOrWhitespace(child.Text);
                bool flag4 = TextBoxWrapPanel.IsCarriageReturn(child.Text);
                bool flag5 = TextBoxWrapPanel.IsLineFeed(child.Text);
                if (!flag4 && !flag5)
                {
                    if (flag1)
                    {
                        if (!flag3)
                        {
                            break;
                        }
                    }
                    else if (!flag2 || flag3)
                    {
                        if (!flag2)
                        {
                            flag2 = flag3;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            currentLine = viewElement.Lines.BinarySearchByBlockIndex(currentBlock.Index);
            return(new TextPosition(currentLine, currentBlock, currentBlock.Length));
        }
Exemple #2
0
        protected virtual bool AreSplittedBlock(ITextBlock firstBlock, ITextBlock secondBlock)
        {
            if (firstBlock == secondBlock || firstBlock == null || secondBlock == null)
            {
                return(false);
            }
            string text1 = firstBlock.Text;
            string text2 = secondBlock.Text;

            return(!TextBoxWrapPanel.IsLineFeed(text1) && !TextBoxWrapPanel.IsLineFeed(text2) && (!TextBoxWrapPanel.IsCarriageReturn(text1) && !TextBoxWrapPanel.IsCarriageReturn(text2)) && (!TextBoxWrapPanel.IsTabOrWhitespace(text1) && !TextBoxWrapPanel.IsTabOrWhitespace(text2)));
        }