void TestBaseTextFormatting(int numberOfSpacesPerTab, string input, string expectedResult)
        {
            ITextViewWhitespace whitespace = GetTextViewWhitespace();

            whitespace.NumberOfSpacesPerTab = numberOfSpacesPerTab;
            string result = whitespace.FormatBaseText(input);

            Assert.AreEqual(result, expectedResult);
        }
        void TestRichTextFormating(int numberOfSpacesPerTab, string baseText, string richText, string expectedResult)
        {
            ITextViewWhitespace whitespace = GetTextViewWhitespace();

            whitespace.NumberOfSpacesPerTab = numberOfSpacesPerTab;
            string result = whitespace.FormatRichText(richText, whitespace.GetTabSizes(baseText));

            Assert.AreEqual(result, expectedResult);
        }
        public void TestShowVisibleWhitespace()
        {
            ITextViewWhitespace whitespace = GetTextViewWhitespace();

            whitespace.NumberOfSpacesPerTab = 4;
            whitespace.Visible = true;
            string result = whitespace.FormatBaseText("\t O \t OO");

            Assert.AreEqual(result[0], whitespace.VisibleTabChar);
            Assert.AreEqual(result[4], whitespace.VisibleSpaceChar);
            Assert.AreEqual(result[7], whitespace.VisibleTabChar);
        }
		public TextView(
			ITextViewDocument document,
			ITextViewAppearance appearance,
			ITextViewAdornments adornments,
			IMouseCursors mouseCursors,
			IMouseCursorRegions mouseCursorRegions,
			ITextViewWhitespace whitespace,
			ISettings settings, 
			IFontManager fontManager)
		{
			_appearance = appearance;
			_adornments = adornments;
			_document = document;
			_mouseCursors = mouseCursors;
			_mouseCursorsRegions = mouseCursorRegions;
			_whitespace = whitespace;
			_settings = settings;
			_fontManager = fontManager;
			_selection = new Selection(document.Caret);
			_document.Caret.Moved += EnsureCursorIsVisible;
		}
예제 #5
0
 public TextView(
     ITextViewDocument document,
     ITextViewAppearance appearance,
     ITextViewAdornments adornments,
     IMouseCursors mouseCursors,
     IMouseCursorRegions mouseCursorRegions,
     ITextViewWhitespace whitespace,
     ISettings settings,
     IFontManager fontManager)
 {
     _appearance            = appearance;
     _adornments            = adornments;
     _document              = document;
     _mouseCursors          = mouseCursors;
     _mouseCursorsRegions   = mouseCursorRegions;
     _whitespace            = whitespace;
     _settings              = settings;
     _fontManager           = fontManager;
     _selection             = new Selection(document.Caret);
     _document.Caret.Moved += EnsureCursorIsVisible;
 }