Exemplo n.º 1
0
        public void RemoveText(Key key)
        {
            var removalInfo = removingAlgorithm.GetChangeInLines(GetVisualLines(), caretViewReader.CaretPosition, key);

            if (removalInfo.LinesToChange.Any())
            {
                DeleteText(removalInfo);
                UpdateSize();
            }
            else if (removalInfo.LinesToRemove.Any())
            {
                DeleteLines(removalInfo.LinesToRemove);
                UpdateSize();
            }
        }
Exemplo n.º 2
0
        public void TwoNonEmptyLinesEnteredDelPressedAtTheEndOfFirstOne_LineShouldBeEqualToText1Text2()
        {
            const string text1 = "asdf";
            const string text2 = "zxcv";
            var          lines = new List <VisualTextLine> {
                VisualTextLine.Create(text1, 0),
                VisualTextLine.Create(text2, 1)
            };
            var newLines = algorithm.GetChangeInLines(lines, new TextPosition(column: 4, line: 0), Key.Delete);

            Assert.AreEqual(text1 + text2, newLines.LinesToChange.First().Value.GetStringContents()[0]);
        }