Skip to content

Commit 031721f

Browse files
plotskiAnonymous
andauthored
Fix typos and document callable that returns formatted text (#1186)
* Fix typos * Reword "Processing .inputrc" section * Document that formatted text can be a callable (fix #948) Co-authored-by: Anonymous <you@example.com>
1 parent 9c7a22b commit 031721f

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

docs/pages/advanced_topics/key_bindings.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,6 @@ information.
334334
Processing `.inputrc`
335335
---------------------
336336

337-
GNU readline can be configured using an `.inputrc` configuration file. This can
338-
could key bindings as well as certain settings. Right now, prompt_toolkit
339-
doesn't support `.inputrc` yet, but it should be possible in the future.
337+
GNU readline can be configured using an `.inputrc` configuration file. This file
338+
contains key bindings as well as certain settings. Right now, prompt_toolkit
339+
doesn't support `.inputrc`, but it should be possible in the future.

docs/pages/full_screen_apps.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ I/O objects
6666
-----------
6767

6868
Every :class:`~prompt_toolkit.application.Application` instance requires an I/O
69-
objects for input and output:
69+
object for input and output:
7070

7171
- An :class:`~prompt_toolkit.input.Input` instance, which is an abstraction
7272
of the input stream (stdin).
@@ -326,7 +326,7 @@ Modal containers
326326
All container objects, like :class:`~prompt_toolkit.layout.VSplit` and
327327
:class:`~prompt_toolkit.layout.HSplit` take a ``modal`` argument.
328328

329-
If this flag has been set, then key bindings from the parent account are not
329+
If this flag has been set, then key bindings from the parent are not
330330
taken into account if one of the children windows has the focus.
331331

332332
This is useful in a complex layout, where many controls have their own key

docs/pages/printing_text.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ There are several ways to display colors:
6060

6161
An instance of any of these four kinds of objects is called "formatted text".
6262
There are various places in prompt toolkit, where we accept not just plain text
63-
(as a strings), but also formatted text.
63+
(as a string), but also formatted text.
6464

6565
HTML
6666
^^^^

prompt_toolkit/application/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class Application(Generic[_AppResult]):
161161
don't want this for the implementation of a REPL. By default, this is
162162
enabled if `full_screen` is set.
163163
164-
Callbacks (all of these should accept a
164+
Callbacks (all of these should accept an
165165
:class:`~prompt_toolkit.application.Application` object as input.)
166166
167167
:param on_reset: Called during reset.

prompt_toolkit/formatted_text/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ def to_formatted_text(
5555
fragments. (Which is the canonical form of formatted text.) The outcome is
5656
always a `FormattedText` instance, which is a list of (style, text) tuples.
5757
58-
It can take an `HTML` object, a plain text string, or anything that
59-
implements `__pt_formatted_text__`.
58+
It can take a plain text string, an `HTML` or `ANSI` object, anything that
59+
implements `__pt_formatted_text__` or a callable that takes no arguments and
60+
returns one of those.
6061
6162
:param style: An additional style string which is applied to all text
6263
fragments.

prompt_toolkit/layout/containers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ def __repr__(self) -> str:
11081108

11091109
class WindowRenderInfo:
11101110
"""
1111-
Render information, for the last render time of this control.
1111+
Render information for the last render time of this control.
11121112
It stores mapping information between the input buffers (in case of a
11131113
:class:`~prompt_toolkit.layout.controls.BufferControl`) and the actual
11141114
render position on the output screen.

prompt_toolkit/layout/controls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ class FormattedTextControl(UIControl):
270270
"""
271271
Control that displays formatted text. This can be either plain text, an
272272
:class:`~prompt_toolkit.formatted_text.HTML` object an
273-
:class:`~prompt_toolkit.formatted_text.ANSI` object or a list of
274-
``(style_str, text)`` tuples, depending on how you prefer to do the
275-
formatting. See ``prompt_toolkit.layout.formatted_text`` for more
276-
information.
273+
:class:`~prompt_toolkit.formatted_text.ANSI` object, a list of ``(style_str,
274+
text)`` tuples or a callable that takes no argument and returns one of
275+
those, depending on how you prefer to do the formatting. See
276+
``prompt_toolkit.layout.formatted_text`` for more information.
277277
278278
(It's mostly optimized for rather small widgets, like toolbars, menus, etc...)
279279

prompt_toolkit/layout/dimension.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Dimension:
2727
:param max: Maximum size.
2828
:param weight: For a VSplit/HSplit, the actual size will be determined
2929
by taking the proportion of weights from all the children.
30-
E.g. When there are two children, one width a weight of 1,
31-
and the other with a weight of 2. The second will always be
30+
E.g. When there are two children, one with a weight of 1,
31+
and the other with a weight of 2, the second will always be
3232
twice as big as the first, if the min/max values allow it.
3333
:param preferred: Preferred size.
3434
"""

0 commit comments

Comments
 (0)