blob: ce9b4385378bcfe72ea2aa464ef52297556f8732 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.width 3 2025-04-21 "Tomo man-pages"
.SH NAME
Text.width \- get display width
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.width\ :\ func(text:\ Text\ ->\ Int)
.fi
.SH DESCRIPTION
Returns the display width of the text as seen in a terminal with appropriate font rendering. This is usually the same as the text's `.length`, but there are some characters like emojis that render wider than 1 cell.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
text Text The text whose length you want. -
.TE
.SH RETURN
An integer representing the display width of the text.
.SH NOTES
This will not always be exactly accurate when your terminal's font rendering can't handle some unicode displaying correctly.
.SH EXAMPLES
.EX
>> "Amélie".width()
= 6
>> "🤠".width()
= 2
.EE
|