예제 #1
0
    static public List <string> GetWordWrapping(string Text, int StartPositionX, int EndPositionX, int StartPositionY, int EndPositionY, Font FontType, int FontSize, FontStyle FStyle = FontStyle.Normal)
    {
        WordWrapping WW = new WordWrapping(Text, StartPositionX, EndPositionX, StartPositionY, EndPositionY, FontType, FontSize, FStyle);

        WW.StartWordWrapping();
        return(WW.lDialoguePerBox);
    }
예제 #2
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Get WordWrapping String
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private List <string> GetWordWrappingString(string Text)
    {
        int StartX = (int)GetDialogueGUIText().pixelOffset.x;
        int StartY = (m_DialogueBox != null) ? ((int)(GetDialogueBoxInstance().pixelInset.yMax) - (int)GetDialogueGUIText().pixelOffset.y)                  : (int)GetDialogueGUIText().pixelOffset.y;
        int EndX   = (m_DialogueBox != null) ?  (int)(GetDialogueBoxInstance().pixelInset.xMin + (GetDialogueBoxInstance().pixelInset.width * 0.8f))   : Screen.width - (int)GetDialogueGUIText().pixelOffset.x;
        int EndY   = (m_DialogueBox != null) ? ((int)(GetDialogueBoxInstance().pixelInset.height * 0.9f) - (int)GetDialogueBoxInstance().pixelInset.yMin)            : Screen.height - (int)GetDialogueGUIText().pixelOffset.y;

        return(WordWrapping.GetWordWrapping(Text, StartX, EndX, StartY, EndY, GetDialogueGUIText().font, GetDialogueGUIText().fontSize, GetDialogueGUIText().fontStyle));
    }
예제 #3
0
        public static DW.WordWrapping import(this WordWrapping wrapping)
        {
            switch (wrapping)
            {
            case WordWrapping.Wrap: return(DW.WordWrapping.Wrap);

            case WordWrapping.NoWrap: return(DW.WordWrapping.NoWrap);
            }

            return(default(DW.WordWrapping));
        }
예제 #4
0
 /// <inheritdoc />
 protected TextElement()
 {
     _font            = "Roboto";
     _text            = "Label";
     _fontSize        = 16.0f;
     _fontWeight      = SharpDX.DirectWrite.FontWeight.Normal;
     _textAlignmentX  = AlignmentX.Center;
     _textAlignmentY  = AlignmentY.Middle;
     _wordWrapping    = WordWrapping.NoWrap;
     TextColour       = Colour.Black;
     TextStrokeColour = new Colour(0, 0, 0, 0);
     _textReady       = true;
 }
예제 #5
0
    public void WrapWords_DoubleWidthCharacters_UsesUnicodeWidth()
    {
        var text    = "每个人都有他的作战策略,直到脸上中了一拳。";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "每个人都有他的作战策",
            "略,直到脸上中了一拳",
            "。",
        },
            wrapped
            );
    }
예제 #6
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Methods: Get WordWrapping
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    static public string GetWordWrapping(string Text, int StartPositionX, int EndPositionX, Font FontType, int FontSize, FontStyle FStyle = FontStyle.Normal)
    {
        WordWrapping WW = new WordWrapping(Text, StartPositionX, EndPositionX, FontType, FontSize, FStyle);

        WW.StartWordWrapping();

        string sWordWrappedText = "";

        foreach (string BoxText in WW.lDialoguePerBox)
        {
            sWordWrappedText += BoxText;
        }

        return(sWordWrappedText);
    }
예제 #7
0
    public void WrapEditableCharacters_DoubleWidthCharacters_UsesStringWidth()
    {
        var text    = "每个人都有他的作战策略,直到脸上中了一拳。";
        var wrapped = WordWrapping.WrapEditableCharacters(new StringBuilder(text), caret: 13, width: 20);

        Assert.Equal(
            new[]
        {
            new WrappedLine(0, "每个人都有他的作战策"),
            new WrappedLine(10, "略,直到脸上中了一拳"),
            new WrappedLine(20, "。"),
        },
            wrapped.WrappedLines
            );
        Assert.Equal(new ConsoleCoordinate(1, 3), wrapped.Cursor);
    }
예제 #8
0
    public void WrapEditableCharacters_DoubleWidthCharactersWithWrappingInMiddleOfCharacter_WrapsCharacter()
    {
        var text    = "每个人都有他的作战策略, 直到脸上中了一拳。";
        var wrapped = WordWrapping.WrapEditableCharacters(new StringBuilder(text), caret: 19, width: 19);

        Assert.Equal(
            new[]
        {
            new WrappedLine(0, "每个人都有他的作战"),          // case 1: we should wrap early, because the next character is a full-width (2-wide) character.
            new WrappedLine(9, "策略, 直到脸上中了"),         // case 2: single width space ("normal" space) sets us to align to width 19 exactly.
            new WrappedLine(19, "一拳。")
        },
            wrapped.WrappedLines
            );

        Assert.Equal(new ConsoleCoordinate(2, 0), wrapped.Cursor);
    }
예제 #9
0
    public void WrapEditableCharacters_GivenLongText_WrapsCharacters()
    {
        var text    = "Here is some text that should be wrapped character by character";
        var wrapped = WordWrapping.WrapEditableCharacters(new StringBuilder(text), text.Length - 5, 20);

        Assert.Equal(
            new[]
        {
            new WrappedLine(0, "Here is some text th"),
            new WrappedLine(20, "at should be wrapped"),
            new WrappedLine(40, " character by charac"),
            new WrappedLine(60, "ter"),
        },
            wrapped.WrappedLines
            );
        Assert.Equal(new ConsoleCoordinate(2, 18), wrapped.Cursor);
    }
예제 #10
0
    public void WrapWords_WithNewLines_SplitsAtNewLines()
    {
        var text    = "Here is some\ntext that should be wrapped word by\nword. supercalifragilisticexpialidocious";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "Here is some",
            "text that should be",
            "wrapped word by",
            "word.",
            "supercalifragilistic",
            "expialidocious",
        },
            wrapped
            );
    }
예제 #11
0
    public void WrapWords_GivenLongText_WrapsWords()
    {
        var text    = "Here is some text that should be wrapped word by word. supercalifragilisticexpialidocious";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "Here is some text",
            "that should be",
            "wrapped word by",
            "word.",
            "supercalifragilistic",
            "expialidocious",
        },
            wrapped
            );
    }
예제 #12
0
 public void Text(double? size = null, Color? color = null, TextAlignment? alignment = null, ParagraphAlignment? paragraphAlignment = null, WordWrapping? wordWrapping = null)
 {
     _state.Text(size, color, alignment, paragraphAlignment, wordWrapping);
 }
예제 #13
0
        static void Main(string[] args)
        {
            // StringProblems
            //Test calls for Reverse string
            string input = "jacob";

            Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray())));
            input = "jake";
            Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray())));
            input = "";
            Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray())));
            input = "jdshjdh@#$%^&)";
            Console.WriteLine(input + "<=>" + new string(SimpleProblem.ReverseString(input.ToCharArray())));

            ReplaceSpaces.TestReplaceSpacesInplace();
            Anagrams.TestIsAnagramAlgo();
            StringRotation.TestIsThisRotatedString();
            RemoveDuplicates.TestRemoveDuplicatesFromString();
            StringToLongConverter.TestStringToLong();
            RegexMatching.TestMatch();
            SumOfTwoNumbersInArray.TestSumOfTwoNumbersInArray();
            SumOfThreeNumbersInArray.TestSumOfThreeNumbersInArray();
            PairInSortedArrayClosestToAParticularValue.TestPairInSortedArrayClosestToAParticularValue();
            PalindromeInStringPermutation.TestPalindromeInStringPermutation();
            EditDistanceBetweenStrings.TestEditDistanceBetweenStrings();
            AnagramIsPalindrome.TestAnagramIsPalindrome();
            GreatestPalindrome.TestGreatestPalindrome();
            ReverseStringWithoutVowels.TestReverseStringWithoutVowels();
            LongestSubstringWithKDistinctChars.TestLongestSubstringWithKDistinctChars();
            // Pattern Matching
            NativePatternMatching.TestNativePatternMatching();
            KMPPatternMatching.TestKMPPatternMatching();
            BoyerMoorePatternMatching.TestPatternMatching();
            RabinKarp.TestRabinKarp();

            //Console.ReadLine();

            //Array Problems
            ArrayOfNumsIncrement.TestIncrementArrayOfNumbers();
            MajorityElement.TestFindMajorityElement();
            Merge2SortedArrays.TestMergeSortedArrays();
            MaxDistanceInArray.TestMaxDistanceInArray();
            MovingAverage.TestMovingAverage();
            TotalAverage.TestTotalAverage();
            ArrayWithGreaterElementToRight.TestArrayWithGreaterElementToRight();
            WaterCollectedInPuddleShownByHistogram.TestWaterCollectedInPuddleShownByHistogram();
            CountOfPairsWhichSumUpToGivenSum.TestCountOfPairsWhichSumUpToGivenSum();
            //Median.TestGetMedianOf2SortedArray();

            // Sorting Problems
            SelectionSort.TestSorting();
            BubbleSort.TestSorting();
            InsertionSort.TestSorting();
            ShellSort.TestSorting();
            MergeSort.TestMergeSort();
            QuickSort.TestQuickSort();
            HeapSortTester.TestHeapSort();
            CountingSort.TestSorting();
            RadixSort.TestRadixSort();
            DutchNationalFlag.TestDutchNationalFlag();
            SortedSquares.TestSortedSquares();

            // Matrix Problem
            Rotate_Matrix_90_degree.TestRotateMatrix();
            Matrix_Column_Rows_0.TestMakeRowColZero1();
            Matrix_Column_Rows_0.TestMakeRowColZero2();
            RotateMatrix180.TestRotateMatrix180();
            SumOfMatrixElementsFormedByRectangleWithCoordinates.TestSumOfMatrixElements();
            SortedArrayFromSortedMatrix.TestSortedArrayFromSortedMatrix();
            SearchWordInMatrix.TestSearchWordInMatrix();
            MaxOnesInRow.TestMaxOnesInRow();
            MatrixAsTriangle.TestMatrixAsTriangle();
            MinRangeInMatrix.TestMinRangeInMatrix();
            PrintMatrixAsSnake.TestPrintMatrixAsSnake();
            PrintMatrixInSpiral.TestPrintMatrixInSpiral();
            MaxSqAreaInBinaryMatrix.TestMaxRectAreaInBinaryMatrix();
            TicTacToeWinner.TestTicTacToeWinner();
            WaterfallCreation.TestWaterfallCreation();

            // Linked list Problems
            DeleteLinkedListNode.TestDeleteFirstNode();
            DeleteDuplicatesFromLinkedList.TestDeleteDuplicates();
            NthLastElementOfLinkedList.TestNthLastNodeOfLinkedList();
            DeleteNodeWithDirectReference.TestDeleteNode();
            AddNumbers.TestAddNumbersRepresentedByLinkedList();
            CopyLinkedListWithRandomNode.TestGetCopiedLinkedListWithRandomNode();
            CommonElementInTwoLinkedList.TestCommonElement();
            ReverseAdjacentNodesInLinkedList.TestReverseAdjacentNodes();
            MergeSortedLinkedList.TestMerge();
            CycleInLinkedList.TestStartOfCycleInLinkedList();
            MedianForCircularLinkedList.TestGetMedian();
            ReverseLinkedList.TestReverseLinkedList();
            SortedCircularLinkedList.TestCircularLinkedList();

            // stack and queue problem
            ThreeStackWithOneArray.TestThreeStackWithOneArray();
            StackWithMinElement.TestStackWithMinElement();
            StackOfPlates.TestStackOfPlates();
            SortAStack.TestSortAStackAscending();
            WellFormedExpression.TestWellFormedExpression();
            QueueVia2Stack.TestQueueVia2Stack();
            LRUCache.TestLRUCache();
            EvaluatePrefixNotation.TestGetPrefixNotationResult();
            EvaluateInflixNotation.TestGetInflixNotationResults();
            EvaluatePostfixNotation.TestGetPostfixNotationResult();
            TestCircularQueue.TestCircularQueueWithDifferentCases();
            LargestAreaInHistogram.TestLargestAreaInHistogram();
            TextEditerWithUndo.TestTextEditerWithUndo();

            //Recursion Problem
            TowerOfHanoi.TestTowerOfHanoi();
            MaxSumOfConsecutiveNums.TestMaxSumOfConsecutiveNums();

            // Back tracking problems
            Sudoku.TestSudokuSolver();
            HamiltonianCycle.TestHamiltonianCycle();
            GraphColoringWithMColors.TestGraphColoringWithMColors();
            MakeLargestIsland.TestMakeLargestIsland();

            //Misc Problem
            MinNumOfCoins.TestMinNumOfCoins();
            IsPrime.TestCheckPrime();
            SquareRoot.TestCalculateSquareRoot();
            CreditCardCheck.TestLuhnAlgo();
            ExcelFirstRowConversion.TestCovertExcelColumnToLong();
            Skyline.TestSkyline();
            SumOfSquaresWithoutMultiplication.TestSumOfSquares();
            MergeIntervals.TestMergeIntervals();
            WidthOfCalendar.TestWidthOfCalendar();
            JosephusProblem.TestJosephusProblem();

            // Permutation and Combination problem
            ShuffleAList.TestFisherYatesAlgo();
            CombinationsOfBinaryString.TestCombinationsOfBinaryString();
            AllCombinationsOfString.TestAllCombinationsOfString();
            AllPermutationsOfString.TestAllPermutationsOfString();
            PhoneNumberToWords.TestPhoneNumberToWords();
            AllNumbersInRangeWithDifferentDigits.TestAllNumbersInRangeWithDifferentDigits();
            DivideSetIntoTwoEqualSetsWithMinSumDiff.TestDivideSetIntoTwoEqualSetsWithMinSumDiff();
            PowerSet.TestPowerSet();
            AllCombinationsOfParenthesis.TestAllCombinationsOfParenthesis();
            GoodDiceRoll.TestGoodDiceRoll();
            PermutationsOfValidTime.TestPermutationsOfValidTime();

            // Tree Problems
            TreeFromExpression.TestCreateTreeFromExpression();
            TestBinarySearchTree.TestDifferentOperationsOnBST();
            AncestorOfTwoNodesInBST.TestAncestorOfTwoNodesInBST();
            CheckBTisBST.TestCheckBTisBST();
            MaxSumOnTreeBranch.TestMaxSum();
            WalkTheTree.TestWalkTheTree();
            SkewedBSTToCompleteBST.TestConvertSkewedBSTToCompleteBST();
            CheckIfTheTreeIsBalanced.TestIsTreeBalanced();
            LinkedListOfTreeNodesAtEachDepth.TestCreateLinkedListOfTreeNodesAtEachDepth();
            PrintBinaryTreeNodeAtEachLevel.TestPrintBinaryTreeNodeAtEachLevel();
            PrintBinaryTreeNodeAtEachLevelSpirally.TestPrintBinaryTreeNodeAtEachLevelSpirally();
            TreeSubtreeOfAnother.TestMatchTree();
            AncestorOfTwoNodesInBT.TestGetAncestorOfTwoNodesInBT();
            AncestorOfMultiNodesInBT.TestAncestorOfMultiNodesInBT();
            LinkedListFromLeavesOfBT.TestLinkedListFromLeavesOfBT();
            ExteriorOfBT.TestPrintExteriorOfBT();
            DepthOfTree.TestGetDepthOfTree();
            TreeToColumns.TestTreeToColumns();
            KthSmallestElementFromBST.TestKthSmallestElementFromBST();
            MakeBSTFromPreOrder.TestMakeBSTFromPreOrder();
            MirrorATree.TestMirrorATree();
            CloneABTWithRandPointer.TestCloneABTWithRandPointer();
            TreeWithInorderAndPreorder.TestTreeWithInorderAndPreorder();
            TreeWithInorderAndPostorder.TestTreeWithInorderAndPostorder();
            TreePathSumsToValue.TestTreePathSumsToValue();
            AllPathInNArayTree.TestAllPathInNArayTree();
            SerializeDeserializeBinaryTree.TestSerializeDeserializeBinaryTree();
            SerializeDeserializeAnNaryTree.TestSerializeDeserializeAnNaryTree();
            AncestorOfTwoNodesInNaryTree.TestAncestorOfTwoNodesInNaryTree();
            AbsOfMaxAndSecondMaxDepthInBT.TestGetAbsOfMaxAndSecondMaxDepthInBT();

            // Trie problems
            CreateAndSearchSimpleTrie.TestCreateAndSearchSimpleTrie();
            // ToDo: have a problem of suffix trees
            ShortestPrefix.TestGetShortestPrefixNotPresentInStringSet();

            // Dynamic Programming problems
            LongestCommonSubsequence.TestGetLongestCommonSubsequence();
            LongestPalindromeSubString.TestGetLongestPalindromeSubString();
            LongestPalindromicSubsequence.TestGetLongestPalindromicSubsequence();
            MaximumAs.TestGetMaximumAs();
            MinNumberOfJumps.TestGetMinimumNumberOfJumps();
            LongestCommonSubString.TestGetLongestCommonSubString();
            KnapSackProblem.TestGetTheMaximumValueWithLimitedWeight();
            TreeCuttingProblem.TestGetTreeCuttingToMaximizeProfits();
            WordBreaking.TestBreakTheWords();
            DistanceOfWords.TestDistanceOfWords();
            LongestIncreasingSubSequence.TestLongestIncreasingSubSequence();
            MinCostPath.TestMinCostPath();
            DifferentWaysForCoinChange.TestDifferentWaysForCoinChange();
            MatrixMultiplication.TestMatrixMultiplication();
            BinomialCoefficient.TestBinomialCoefficient();
            BoxStacking.TestBoxStacking();
            WordWrapping.TestWordWrapping();
            MaxSubMatrixWithAllOnes.TestMaxSubMatrixWithAllOnes();
            LongestSubStringWithEqualSum.TestLongestSubStringWithEqualSum();
            PartitionArrayIntoEqualSumSets.TestPartitionArrayIntoEqualSumSets();
            MaxSumRectangle.TestMaxSumRectangle();
            RegularExpressionMatch.TestRegularExpressionMatch();
            NumRepresentedByPerfectSquares.TestNumRepresentedByPerfectSquares();
            LongestCommonSubsequenceInSameString.TestLongestCommonSubsequenceInSameString();
            StringDecodeAsAlphabets.TestStringDecodeAsAlphabets();
            BalloonBursting.TestBalloonBursting();
            TravellingSalesmanProblem.TestTravellingSalesmanProblem();
            MaxSumWithoutAdjacentElements.TestMaxSumWithoutAdjacentElements();
            MaxPathThroughMatrix.TestMaxPathThroughMatrix();
            BrickLaying.TestBrickLaying();
            JobSchedullingWithConstraints.TestJobSchedullingWithConstraints();
            EggDropMinTrials.TestEggDropMinTrials();

            // Graph Problems
            ShortestPath.TestGetShortestPathBetween2Vertex();
            CycleInDirectedGraph.TestIsCycleInDirectedGraph();
            CycleInUnDirectedGraph.TestIsCycleInUnDirectedGraph();
            SolveAMaze.TestSolveAMaze();
            AllPathsGivenStartEndVertex.TestGetAllPathsInGraphFromStartVertexToEndVertex();
            AllPaths.TestGetAllPathsInGraphFromStartVertex();
            ColorVertices.TestColorVerticesWithDifferentColor();
            CheckBipartiteGraph.TestCheckBipartiteGraph();
            TransformOneWordToAnother.TestGetTransformation();
            ConstraintsVerification.TestConstraintsVerification();
            ExtendedContactsInSocialNetwork.TestComputeExtendedContacts();
            CourseScheduling.TestCourseScheduling();
            SnakeAndLadder.TestSnakeAndLadder();
            IsGraphATree.TestIsGraphATree();
            ReverseGraph.TestReverseGraph();
            StronglyConnectedGraph.TestStronglyConnectedGraph();
            ConnectedComponents.TestConnectedComponents();
            ContinentalDivide.TestContinentalDivide();
            CloneGraph.TestCloneGraph();
            Wordament.TestWordament();
            // ShortestPathAlgo
            FloydWarshall.TestFloydWarshall();
            DijkstraAlgorithm.TestDijkstraAlgorithm();
            BellmanFord.TestBellmanFord();
            TravelFromLeftToRightInMatrix.TestTravelFromLeftToRightInMatrix();
            HeuristicSearch.TestHeuristicSearch();
            AStar.TestAStar();
            ShortestPathWhenObstaclesRemoved.TestShortestPathWhenObstaclesRemoved();
            ShortestDistanceFromRoomsToGates.TestShortestDistanceFromRoomsToGates();
            //MaxFlow
            FordFulkersonEdmondKarp.TestFordFulkersonEdmondKarp();
            MinCut.TestMinCut();
            MaximumBipartiteMatching.TestMaximumBipartiteMatching();
            //Minimum Spanning Tree
            KruskalAlgorithm.TestKruskalAlgorithm();
            PrimsAlgorithm.TestPrimsAlgorithm();


            //Heap problems
            BasicMaxHeap.TestMaxHeap();
            BasicMinHeap.TestMinHeap();
            TestMinHeapMap.DoTest();
            TestPriorityQueue.Run();
            MedianForAStreamOfNumbers.TestMedianForAStreamOfNumbers();

            //DisjointSets
            TestingDisjointSet.Run();
            //TestWeightedDisjointSetsWithPathCompression.Run(); // this runs slow, hence commenting it

            //Geometry
            ClosestPairOfPoints.TestClosestPairOfPoints();
            RectangleIntersection.TestRectangleIntersection();
            LineSegmentIntersection.TestLineSegmentIntersection();
            ConvexHull.TestConvexHull();
            KClosestPointToOrigin.TestKClosestPointToOrigin();

            //Greedy Algorithm
            HuffmanCoding.TestHuffmanCoding();

            //Randomized Algorithm
            RandomGeneration.TestRandomGeneration();

            // Bit Algorithms
            IntHaveOppositeSigns.TestIntHaveOppositeSigns();
            Parity.TestParity();

            //Math Problem
            ZerosInFactorial.TestZerosInFactorial();
            GetAllPrimeFactors.TestGetAllPrimeFactors();
            NumberOfFactors.TestNumberOfFactors();
            AllFactors.TestAllFactors();
            MultiplyLongNumbers.TestMultiplyLongNumbers();
            NextLargestPermutation.TestNextLargestPermutation();
            AllPrimesTillN.TestAllPrimesTillN();
            PascalsTriangle.TestPascalsTriangle();
            SubtractLongNumbers.TestSubtractLongNumbers();

            //Search problems
            SearchInSortedRotatedArray.TestSearchInSortedRotatedArray();
            KClosestElementInArray.TestKClosestElementInArray();
            SearchInSortedMatrix.TestSearchInSortedMatrix();
            BinarySearchUnbounded.TestBinarySearchUnbounded();
            LinkedListSublistSearch.TestLinkedListSublistSearch();
            NoOfOccuranceInSortedArray.TestNoOfOccuranceInSortedArray();
            GetSmallestInSortedRotatedArray.TestGetSmallestInSortedRotatedArray();

            //Distributed algorithms
            KWayMerge.TestKWayMerge();


            Console.ReadLine();
        }
예제 #14
0
        public void Text(
            double? size,
            Color? color,
            TextAlignment? alignment,
            ParagraphAlignment? paragraphAlignment,
            WordWrapping? wordWrapping)
        {
            if (size != null)
                TextSize = size.Value;

            if (color != null)
                TextColor = color.Value;

            if (alignment != null)
                TextAlignment = alignment.Value;

            if (paragraphAlignment != null)
                ParagraphAlignment = paragraphAlignment.Value;

            if (wordWrapping != null)
                WordWrapping = wordWrapping.Value;
        }
예제 #15
0
    /// <summary>
    /// This is just an extra function used by <see cref="Prompt.RenderAnsiOutput"/> that highlights arbitrary text. It's
    /// not used for drawing input during normal functioning of the prompt.
    /// </summary>
    public static Row[] ApplyColorToCharacters(IReadOnlyCollection <FormatSpan> highlights, string text, int textWidth)
    {
        var wrapped = WordWrapping.WrapEditableCharacters(new StringBuilder(text), 0, textWidth);

        return(ApplyColorToCharacters(highlights, wrapped.WrappedLines, selection: null, selectedTextBackground: null));
    }
예제 #16
0
 public void Text(
     double? size,
     Color? color,
     TextAlignment? alignment,
     ParagraphAlignment? paragraphAlignment,
     WordWrapping? wordWrapping)
 {
     record(t => t.Text(size, color, alignment, paragraphAlignment, wordWrapping));
 }