Skip to content

Commit b217ed4

Browse files
committed
brevity of README.rst and polish
1 parent a1dd2f9 commit b217ed4

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

README.rst

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
:target: https://pypi.python.org/pypi/wcwidth/
1111
:alt: Latest Version
1212

13-
.. image:: https://pypip.in/license/wcwidth/badge.svg
13+
.. image:: https://img.shields.io/github/license/jquast/wcwidth.svg
1414
:target: https://pypi.python.org/pypi/wcwidth/
1515
:alt: License
1616

17-
.. image:: https://pypip.in/wheel/wcwidth/badge.svg
17+
.. image:: https://img.shields.io/pypi/wheel/wcwidth.svg
1818
:alt: Wheel Status
1919

2020
.. image:: https://img.shields.io/pypi/dm/wcwidth.svg
@@ -52,19 +52,26 @@ The stable version of this package is maintained on pypi, install using pip::
5252

5353
pip install wcwidth
5454

55-
wcwidth, wcswidth
56-
-----------------
57-
Use ``wcwidth`` to determine the length of a *single character*,
58-
and ``wcswidth`` to determine the length of a *string of characters*.
55+
Example
56+
-------
5957

6058
To Display ``u'コンニチハ'`` right-adjusted on screen of 80 columns::
6159

6260
>>> from wcwidth import wcswidth
6361
>>> text = u'コンニチハ'
6462
>>> print(u' ' * (80 - wcswidth(text)) + text)
6563

66-
Return Values
67-
-------------
64+
wcwidth, wcswidth
65+
-----------------
66+
Use function ``wcwidth()`` to determine the length of a *single character*,
67+
and ``wcswidth()`` to determine the length of a *string of characters*.
68+
69+
Function ``wcswidth()`` simply returns the sum of all values along a string,
70+
individually mapped over function ``wcwidth()``, or, ``-1`` in total
71+
if any part of the string's return value from ``wcwidth()`` results in
72+
a value of ``-1``.
73+
74+
Return values of wcwidth are:
6875

6976
``-1``
7077
Indeterminate (not printable).
@@ -79,29 +86,22 @@ Return Values
7986
``1``
8087
All others.
8188

82-
``wcswidth()`` simply returns the sum of all values along a string, or
83-
``-1`` in total if any part of the string results in -1. A more exact
84-
list of conditions and return values may be found in the docstring::
89+
A more exact list of conditions of these return values may be found in the
90+
module docstring::
8591

8692
$ pydoc wcwidth
8793

88-
89-
Discrepancies
90-
-------------
94+
=======
95+
Caveats
96+
=======
9197

9298
This library does its best to return the most appropriate return value for a
9399
very particular terminal user interface where a monospaced fixed-cell
94-
rendering is expected. As the POSIX Terminal programming interfaces do not
95-
provide any means to determine the unicode support level, we can only do our
96-
best to return the *correct* result for the given codepoint, and not what any
97-
terminal emulator particular does.
98-
99-
Python's determination of non-zero combining_ characters may also be based on
100-
an older specification.
101-
102-
You may determine an exacting list of these discrepancies using the project
103-
files `wcwidth-libc-comparator.py <https://github.com/jquast/wcwidth/tree/master/bin/wcwidth-libc-comparator.py>`_ and `wcwidth-combining-comparator.py <https://github.com/jquast/wcwidth/tree/master/bin/wcwidth-combining-comparator.py>`_.
104-
100+
rendering is expected. As the POSIX Terminal programming interface does not
101+
provide any means to determine the unicode support level of a connecting
102+
terminal, we can only do our best to return what we **assume** to be correct
103+
for the given codepoint, and not the result of any terminal emulator
104+
particular.
105105

106106
==========
107107
Developing
@@ -112,6 +112,9 @@ for running tests (``python setup.py test``), updating tables (
112112
``python setup.py update``) or using any of the scripts in the ``bin/``
113113
sub-folder. These files are only made available in the source repository.
114114

115+
You may determine an exacting list of these discrepancies using the project
116+
file `wcwidth-libc-comparator.py
117+
<https://github.com/jquast/wcwidth/tree/master/bin/wcwidth-libc-comparator.py>`_.
115118

116119
Updating Tables
117120
---------------
@@ -134,8 +137,8 @@ whose latest version is available at
134137
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c And is authored by Markus Kuhn,
135138
2007-05-26 (Unicode 5.0).
136139

137-
Examples
138-
--------
140+
Uses
141+
----
139142

140143
This library is used in:
141144

@@ -152,8 +155,9 @@ distributed as a script or part of the module.
152155
.. _`jonathanslenders/python-prompt-toolkit`: https://github.com/jonathanslenders/python-prompt-toolkit
153156

154157

155-
Changes
156-
-------
158+
=======
159+
History
160+
=======
157161

158162
0.1.5 *2015-09-13 Alpha*
159163
* **Bugfix**:

0 commit comments

Comments
 (0)