summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-01-16 10:55:58 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-01-16 10:55:58 -0500
commit6ef3b08257c768b353d3cfa726e3f19c34f0cf53 (patch)
tree3394a30e80f187e9641b458aa05cf7d5f96f7e17 /docs
parentfa2de84eacefe2d1eef969fa3e4de70df176c758 (diff)
downloadcmd2-git-6ef3b08257c768b353d3cfa726e3f19c34f0cf53.tar.gz
Updating some doc text
Diffstat (limited to 'docs')
-rw-r--r--docs/features/generating_output.rst20
1 files changed, 14 insertions, 6 deletions
diff --git a/docs/features/generating_output.rst b/docs/features/generating_output.rst
index 2c110ea2..f3d2a7f4 100644
--- a/docs/features/generating_output.rst
+++ b/docs/features/generating_output.rst
@@ -137,13 +137,21 @@ users can modify to control whether these escape codes are passed through to
the terminal or not.
-Centering Text
+Aligning Text
--------------
-If you would like to generate output which is centered in the user's terminal,
-the :meth:`cmd2.utils.align_center` method can help. Pass it a string and it
-will figure out the width of the terminal and return you a new string,
-appropriately padded so it will be centered.
+If you would like to generate output which is left, center, or right aligned within a
+specified width or the terminal width, the following functions can help:
+
+- :meth:`cmd2.utils.align_left`
+- :meth:`cmd2.utils.align_center`
+- :meth:`cmd2.utils.align_right`
+
+These functions differ from Python's string justifying functions in that they support
+characters with display widths greater than 1. Additionally, ANSI style sequences are safely
+ignored and do not count toward the display width. This means colored text is supported. If
+text has line breaks, then each line is aligned independently.
+
Columnar Output
@@ -157,5 +165,5 @@ in the output to generate colors on the terminal.
The :meth:`cmd2.ansi.style_aware_wcswidth` function solves both of these
problems. Pass it a string, and regardless of which Unicode characters and ANSI
-escape sequences it contains, it will tell you how many characters on the
+text style escape sequences it contains, it will tell you how many characters on the
screen that string will consume when printed.