Simple Python terminal (TUI) multi-line editor
Features:
simple multi-line editor
not whole screen but only next N lines
status bar (supporting multiple lines): show interactive feedback. e.g. mark edits, show number of edits, show diff in separate plane or so
This is just a simple multi-line editor for the terminal (VT100). It is a bit like input (doc) but supporting multiple lines and behaving more like a simple editor. It is different to other editors and other TUI frameworks in that it will not go full-screen but only use the last N lines of the terminal. It is intended to be simple and flexible and hackable, i.e. the behavior can be changed, typing events can be handled, etc. It takes extra care to handle terminal resizing. It also supports to show a status bar (potential multi-line).
Homepage: https://github.com/albertz/py-tui-editor
Installation
The project is on PyPI: https://pypi.org/project/tui-editor/
Thus you can just do:
pip install tui-editor
Usage
Simple empty editor:
>>> from tui_editor import TuiEditor
>>> editor = TuiEditor()
>>> editor.edit()
>>> editor.get_text()
'Hello World!'
Predefined editable text:
>>> from tui_editor import TuiEditor
>>> editor = TuiEditor()
>>> editor.set_text('Hello World!')
>>> editor.edit()
>>> editor.get_text()
'Hello World!'
See demo-prompt.py and demo-editor.py.
Screenshot
Screencast
This shows the demo-prompt.py and demo-editor.py.
This uses a very custom small app, which I use to take over annotated PDF edits into my Latex file, where I get the editor, and it shows me the live-diff in the status bar of the editor.
Licence
MIT License
History
2015 Paul Sokolovsky: picotui project seditor.py example. 2022 Albert Zeyer: extend and redesign and package just the text editor as this library.
References
https://en.wikipedia.org/wiki/ANSI_escape_code https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Metadata
Release files for tui-editor 1.20230114.224756
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tui-editor-1.20230114.224756.tar.gz | 11.3 kB | Details |
Release files / tui-editor-1.20230114.224756.tar.gz
| Download URL | tui-editor-1.20230114.224756.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a968b63af110ab61fd9b0fd6f7663843f2b2bc2f74648c3eda4018c2240ae70b
|
|
BLAKE2b-256 checksum How to use checksums |
6fc48ca9e113e2435ade917f5288a4d30673789b9f27c040034e7c52bc53e614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|