Repository navigation
Modern Tui TuiWrap
Paul Squires edited this page Oct 19, 2026
·
5 revisions
Home › Terminal TUI Library › Unicode Width › TuiWrap
Breaks text into lines that fit a number of columns, keeping its line breaks.
TuiWrap( byref s as ustring, byval cols as int32 ) as TuiStringArrayWord-wraps to a column width, returning the lines. Embedded chr(10) starts a new line. This is what TuiParagraph uses, which is why paragraph wrapping is correct for CJK.
#import "std/tui"
using tui
dim as TuiStringArray lines_ = TuiWrap( "the quick brown fox jumps", 10 )
for i as int32 = 0 to lines_.Count( ) - 1
print "["; lines_[i]; "]"
next
'' [the quick ]
'' [brown fox ]
'' [jumps]
''
'' NOTE THE TRAILING SPACE: the break space stays on the line it broke after,
'' so a wrapped line can measure one column wider than you expect. Right-align
'' or box wrapped text and you will see it.
'' a newline is honoured, not swallowed
print TuiWrap( "a" & chr( 10 ) & "b", 40 ).Count( ) '' 2TuiCharWidth · TuiStringWidth · TuiTruncate · TuiSetAmbiguousWide · TuiAmbiguousWide
Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Unicode Width
Working examples: hello.tiko · form.tiko · dashboard.tiko
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing