public void EndOfSnapshot() { Create("cat", "dog"); var point = new SnapshotPoint(_textBuffer.CurrentSnapshot, _textBuffer.CurrentSnapshot.Length); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Line, point, point, _vimBuffer.LocalSettings.TabStop); Assert.Equal(1, visualSpan.AsLine().LineRange.LastLineNumber); }
public void Backwards() { Create("big cat", "big dog"); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, _textBuffer.GetPoint(2), _textBuffer.GetPoint(0), _vimBuffer.LocalSettings.TabStop); var blockSpan = new BlockSpan(_textBuffer.GetPoint(0), _vimBuffer.LocalSettings.TabStop, 2, 1); Assert.Equal(blockSpan, visualSpan.AsBlock().BlockSpan); }
public void SamePoint() { Create("cat", "dog", "tree"); var point = _textBuffer.GetLine(1).Start; var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Line, point, point, _vimBuffer.LocalSettings.TabStop); Assert.Equal(_textBuffer.GetLineRange(1), visualSpan.AsLine().LineRange); }
public void ForwardsMultipleLines() { Create("big cat", "big dog"); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, _textBuffer.GetPoint(1), _textBuffer.GetPointInLine(1, 3), _vimBuffer.LocalSettings.TabStop); var blockSpan = new BlockSpan(_textBuffer.GetPoint(1), _vimBuffer.LocalSettings.TabStop, 2, 2); Assert.Equal(blockSpan, visualSpan.AsBlock().BlockSpan); }
public void CreateForSelectionPoints_Block_ForwardsMultipleLines() { Create("big cat", "big dog"); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, _textBuffer.GetPoint(1), _textBuffer.GetPointInLine(1, 3)); var blockSpan = new BlockSpan(_textBuffer.GetPoint(1), 2, 2); Assert.Equal(blockSpan, visualSpan.AsBlock().Item); }
public void CreateForSelectionPoints_Block_Backwards() { Create("big cat", "big dog"); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, _textBuffer.GetPoint(2), _textBuffer.GetPoint(0)); var blockSpan = new BlockSpan(_textBuffer.GetPoint(0), 2, 1); Assert.Equal(blockSpan, visualSpan.AsBlock().Item); }
public void Empty() { Create("dog cat"); var point = _textBuffer.GetPoint(2); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Character, point, point, _vimBuffer.LocalSettings.TabStop); Assert.Equal(point, visualSpan.AsCharacter().CharacterSpan.Start); Assert.Equal(0, visualSpan.AsCharacter().CharacterSpan.Length); }
public void Empty() { Create("dog cat"); var point = _textBuffer.GetPoint(2); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, point, point, _vimBuffer.LocalSettings.TabStop); var blockSpan = new BlockSpan(point, _vimBuffer.LocalSettings.TabStop, spaces: 1, height: 1); Assert.Equal(blockSpan, visualSpan.AsBlock().BlockSpan); }
public void CreateForSelectionPoints_Character_Empty() { Create("dog cat"); var point = _textBuffer.GetPoint(2); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Character, point, point); Assert.Equal(point, visualSpan.AsCharacter().Item.Start); Assert.Equal(0, visualSpan.AsCharacter().Item.Length); }
public void CreateForSelectionPoints_Block_Empty() { Create("dog cat"); var point = _textBuffer.GetPoint(2); var visualSpan = VisualSpan.CreateForSelectionPoints(VisualKind.Block, point, point); var blockSpan = new BlockSpan(point, 0, 1); Assert.Equal(blockSpan, visualSpan.AsBlock().Item); }