Table of Contents

Method WordWrapText

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

WordWrapText(string, int, bool, int, TextDirection, TextFormatter?)

Formats the provided text to fit within the width provided using word wrapping.

public static List<string> WordWrapText(string text, int width, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom, TextFormatter? textFormatter = null)

Parameters

text string

The text to word wrap

width int

The number of columns to constrain the text to

preserveTrailingSpaces bool

If true trailing spaces at the end of wrapped lines will be preserved. If false , trailing spaces at the end of wrapped lines will be trimmed.

tabWidth int

The number of columns used for a tab.

textDirection TextDirection

The text direction.

textFormatter TextFormatter

TextFormatter instance to access any of his objects.

Returns

List<string>

A list of word wrapped lines.

Remarks

This method does not do any alignment.

This method strips Newline ('\n' and '\r\n') sequences before processing.

If preserveTrailingSpaces is false at most one space will be preserved at the end of the last line.