Skip to main content

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 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).

Installation

The project is on PyPI: https://pypi.org/project/tui-editor/

Thus you can just do:

pip install tui-editor

Usage

>>> from tui_editor import TuiEditor
>>> editor = TuiEditor()
>>> editor.edit()
>>> editor.get_text()
'Hello World!'

Motivation

Python TUI?

What I want: - simple multi-line editor - not whole screen but only partial - show interactive feedback. e.g. mark edits, show number of edits, show diff in separate plane or so

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#Terminal_input_sequences https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer

Metadata

Release files for tui-editor 1.20220820.235258

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tui-editor 1.20220820.235258
File Size Uploaded
tui-editor-1.20220820.235258.tar.gz 6.8 kB Details

Release files / tui-editor-1.20220820.235258.tar.gz

Download URL tui-editor-1.20220820.235258.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dc850a79488d04b0caa85f145c9d8bcbe6e4cf713547aa1b6f5b5d5595dc2c35
BLAKE2b-256 checksum
How to use checksums
bd3b357ca0339b887e359488c2758af63d3ea13c4656ff9eae0e29254dc314ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page