Home

Awesome

tui-realm-textarea

<p align="center">~ Textarea component for tui-realm ~</p> <p align="center"> <a href="https://github.com/rhysd/tui-textarea" target="_blank">tui-textarea</a> ยท <a href="https://github.com/veeso/tui-realm" target="_blank">tui-realm</a> ยท <a href="https://docs.rs/tui-realm-textarea" target="_blank">Documentation</a> </p> <p align="center">Developed by <a href="https://veeso.github.io/" target="_blank">@veeso</a></p> <p align="center">Current version: 1.1.2 (29/08/2023)</p> <p align="center"> <a href="https://opensource.org/licenses/MIT" ><img src="https://img.shields.io/badge/License-MIT-teal.svg" alt="License-MIT" /></a> <a href="https://github.com/veeso/tui-realm-textarea/stargazers" ><img src="https://img.shields.io/github/stars/veeso/tui-realm-textarea.svg" alt="Repo stars" /></a> <a href="https://crates.io/crates/tui-realm-textarea" ><img src="https://img.shields.io/crates/d/tui-realm-textarea.svg" alt="Downloads counter" /></a> <a href="https://crates.io/crates/tui-realm-textarea" ><img src="https://img.shields.io/crates/v/tui-realm-textarea.svg" alt="Latest version" /></a> <a href="https://ko-fi.com/veeso"> <img src="https://img.shields.io/badge/donate-ko--fi-red" alt="Ko-fi" /></a> </p> <p align="center"> <a href="https://github.com/veeso/tui-realm-textarea/actions" ><img src="https://github.com/veeso/tui-realm-textarea/workflows/Build/badge.svg" alt="CI" /></a> <a href="https://docs.rs/tui-realm-textarea" ><img src="https://docs.rs/tui-realm-textarea/badge.svg" alt="Docs" /></a> </p>

About tui-realm-textarea โœ๏ธ

tui-realm-textarea is an implementation of a textarea component for tui-realm. It is based on the tui-textarea component by rhysd.

Demo


Get started ๐Ÿ

Add tui-realm-textarea to your Cargo.toml ๐Ÿฆ€

tui-realm-textarea = "^1.1.0"

Or if you don't use Crossterm, define the backend as you do with tui-realm:

tui-realm-textarea = { version = "^1.1.0", default-features = false, features = [ "with-termion" ] }

Features โš™๏ธ

These features can be enabled in tui-realm-textarea:

Examples ๐Ÿ“‹

View how to use the textarea component in the example. The example contains a simple text editor.

cargo run --example demo --features clipboard,search

Press ESC to quit


Component API

Commands:

CmdResultBehaviour
Custom($TEXTAREA_CMD_NEWLINE)NoneInsert newline
Custom($TEXTAREA_CMD_DEL_LINE_BY_END)NoneDelete line by end to current position
Custom($TEXTAREA_CMD_DEL_LINE_BY_HEAD)NoneDelete line by head to current position
Custom($TEXTAREA_CMD_DEL_WORD)NoneDelete the current word
Custom($TEXTAREA_CMD_DEL_NEXT_WORD)NoneDelete the next word
Custom($TEXTAREA_CMD_MOVE_WORD_FORWARD)NoneMove to the next word
Custom($TEXTAREA_CMD_MOVE_WORD_BACK)NoneMove to the previous word
Custom($TEXTAREA_CMD_MOVE_PARAGRAPH_BACK)NoneMove to the previous paragraph
Custom($TEXTAREA_CMD_MOVE_PARAGRAPH_FORWARD)NoneMove to the next paragraph
Custom($TEXTAREA_CMD_MOVE_TOP)NoneMove to the beginning of the file
Custom($TEXTAREA_CMD_MOVE_BOTTOM)NoneMove to the end of the file
Custom($TEXTAREA_CMD_UNDO)NoneUndo last change
Custom($TEXTAREA_CMD_REDO)NoneRedo last change
Custom($TEXTAREA_CMD_PASTE)NonePaste the current content of the buffer
Custom($TEXTAREA_CMD_SEARCH_BACK)NoneGo to the previous search match
Custom($TEXTAREA_CMD_SEARCH_FORWARD)NoneGo to the next search match
CancelNoneDelete next char
DeleteNoneDelete previous char
GoTo(Begin)NoneGo to the head of the line
GoTo(End)NoneGo to the end of the line
Move(Down)NoneMove to the line below
Move(Up)NoneMove to the line above
Move(Left)NoneMove cursor to the left
Move(Right)NoneMove cursor to the right
Scroll(Up)NoneMove by scroll_step lines up
Scroll(Down)NoneMove by scroll_step lines down
Type(ch)NoneType a char in the editor
SubmitSubmitGet current lines

โ— Paste command is supported only if the clipboard feature is enabled

State: the state returned is a Vec(String) containing the lines in the text area.

Properties:

Footer and status format

The status and footer bars support a special syntax. The following keys can be inserted into the string:


Documentation ๐Ÿ“š

The developer documentation can be found on Rust Docs at https://docs.rs/tui-realm-textarea


Contributing and issues ๐Ÿค๐Ÿป

Contributions, bug reports, new features and questions are welcome! ๐Ÿ˜‰ If you have any question or concern, or you want to suggest a new feature, or you want just want to improve tui-realm, feel free to open an issue or a PR.

Please follow our contributing guidelines


Changelog โณ

View tui-realm-textarea's changelog HERE


Support the developer โ˜•

If you like tui-realm and you're grateful for the work I've done, please consider a little donation ๐Ÿฅณ

You can make a donation with one of these platforms:

ko-fi PayPal


License ๐Ÿ“ƒ

tui-realm-textarea is licensed under the MIT license.

You can read the entire license HERE