TUI input library supporting multiple backends

Overview

tui-input

Crate Status Docs Status

tui-input.gif

WARNING: Most of the functionality is only human tested.

A TUI input library supporting multiple backends.

This crate can be used with tui-rs.

Install

Cargo.toml

# crossterm
tui-input = "*"

# termion
tui-input = { version = "*", features = ["termion"], default-features = false }

Features

  • crossterm (default)
  • termion
  • serde

Demo

See examples.

(Not yet) used in

TODO

Comments
  • Handling multi-space characters (Japanese, Chinese...) width better

    Handling multi-space characters (Japanese, Chinese...) width better

    Continuing #530, i added visual_cursor method as discussed, but currently fighting incorrect display at scroll position.

    Currently I'm not sure if code in example is to blame or tui-rs. Investigating.

    opened by Elvyria 4
  • Systematic crash when deleting input containing unicode characters

    Systematic crash when deleting input containing unicode characters

    Hi @sayanarijit

    Thank you very much for this amazing crate.

    I'm encountering a systematic crash whenever I write strings containing unicode characters.

    It's crashing on input.rs: 115: self.value.remove(self.cursor);

    A minimum reproducible example is:

    let mut string = "¡¡¡¡".to_string();
    string.remove(1);
    

    thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside '¡' (bytes 0..2) of¡¡¡¡'

    For now just creating the issue to signal the weakness. I'll create a PR if I find a clean solution

    opened by MrCasCode 1
  • Make the API more convenient

    Make the API more convenient

    • Support let input = Input::new("Hello");
    • Support let input: Input = "Hello".into();
    • Support let input: Input = String::new("Hello").into();
    • Support let value: String = input.into();
    • Support println!("{}", input);
    • Add method input.reset(); to reset the values.
    • Upgrade dependencies
    opened by sayanarijit 0
  • Simplify API

    Simplify API

    • InputRequest::Submitted and InputRequest::Escapped has been deprecated. Match against the keyboard event instead.
    • Input::handle now returns InputResponse (not optional).
    • The struct StateChanged has been deprecated. Use InputResponse::StateChanged {..}
    • InputResponse::Unchanged is returned when neither the value, nor the cursor changes.
    opened by sayanarijit 0
  • Set cursor support

    Set cursor support

    • with_value auto sets the cursor.
    • with_cursor auto adjusts based on the value.
    • Use InputRequest::SetCursor() to set cursor to some specific value (auto adjusted).
    opened by sayanarijit 0
Releases(v0.6.1)
  • v0.6.1(Nov 13, 2022)

    • Added new method visual_cursor to make it easy for handling multispace characters (Japanese, Chinese) better in tui-rs ~ by @Elvyria.
    • Added visual_scroll to accompany visual_cursor in tui-rs ~ @sayanarijit.
    • Updated tui-rs example ~ by @sayanarijit & @Elvyria.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Oct 4, 2022)

    • BREAKING: Crossterm backend's to_input_request() now takes a reference instead of an owned event.
    • Added EventHandler trait in each backend to enable passing events directly to input.handle_event() instead of using to_input_request().
    • Updated dependencies.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Sep 10, 2022)

  • v0.5.0(Sep 10, 2022)

  • v0.4.2(May 30, 2022)

  • v0.4.1(May 28, 2022)

    • Support let input = Input::new("Hello");
    • Support let input: Input = "Hello".into();
    • Support let input: Input = String::new("Hello").into();
    • Support let value: String = input.into();
    • Support println!("{}", input);
    • Add method input.reset(); to reset the values.
    • Upgrade dependencies
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(May 16, 2022)

  • v0.3.0(May 15, 2022)

    • InputRequest::Submitted and InputRequest::Escapped has been deprecated. Match against the keyboard event instead.
    • Input::handle now returns InputResponse (not optional).
    • The struct StateChanged has been deprecated. Use InputResponse::StateChanged {..}
    • InputResponse::Unchanged is returned when neither the value, nor the cursor changes.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(May 15, 2022)

  • v0.2.0(May 15, 2022)

  • v0.1.2(Nov 4, 2021)

    • with_value auto sets the cursor.
    • with_cursor auto adjusts based on the value.
    • Use InputRequest::SetCursor() to set cursor to some specific value (auto adjusted).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Nov 4, 2021)

Owner
Arijit Basu
Getting spoiled by Rust & Elm
Arijit Basu
garbage-collecting on-disk object store, supporting higher level KV stores and databases.

marble Garbage-collecting disk-based object-store. See examples/kv.rs for a minimal key-value store built on top of this. Supports 4 methods: read: de

Komora 160 Nov 25, 2022
A library that creates a terminal-like window with feature-packed drawing of text and easy input handling. MIRROR.

BearLibTerminal provides a pseudoterminal window with a grid of character cells and a simple yet powerful API for flexible textual output and uncompli

Tommy Ettinger 43 Oct 31, 2022
Simple console input macros with the goal of being implemented in the standard library.

Simple console input macros with the goal of being implemented in the standard library.

undersquire 2 Feb 10, 2022
Command line utility to remove duplicates from the given input.

Command line utility to remove duplicates from the given input. Note that huniq does not sort the input, it just removes duplicates.

Karolin Varner 185 Nov 18, 2022
omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode.

omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode. omekasy means "dress up" in Japanese.

null 105 Nov 16, 2022
Fuzzy Index for Python, written in Rust. Works like error-tolerant dict, keyed by a human input.

FuzzDex FuzzDex is a fast Python library, written in Rust. It implements an in-memory fuzzy index that works like an error-tolerant dictionary keyed b

Tomasz bla Fortuna 8 Sep 15, 2022
Checkline: checkbox line picker for stdin line input

checkline is a Unix command line interface (CLI) terminal user interface (TUI) that prompts you to check each line of stdin, to pick each line to output to stdout

SixArm 3 Nov 1, 2022
`rusty_regex` takes an input string and produces a `regex` string representing what was provided.

rusty_regex This project provides a binary that takes an input string, and preps it for regex usage, effectively replacing known generics and producin

Chris Speakes 2 Nov 20, 2022
Tiny color conversion library for TUI application builders

Definition of ANSI, RGB and HSL color types and all the conversions between them. There are many other color conversion crates. This one may be useful

Canop 7 Oct 7, 2022
Rust TUI library - Clipping region is a set of min/max x/y values applied to the existing region

TinyBit Clipping region is a set of min/max x/y values applied to the existing region A TUI lib This is not yet production ready T O D O TODO: bugs: T

Togglebit 13 May 3, 2022
A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf.

xplr A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf. [Quickstart] [Features] [Plugins] [Documentation] [Upgrade Guide] [

Arijit Basu 2.5k Dec 1, 2022
Rust TUI client for steamcmd

Steam TUI About Just a simple TUI client for steamcmd. Allows for the graphical launching, updating, and downloading of steam games through a simple t

Dylan Madisetti 577 Nov 28, 2022
Another TUI based system monitor, this time in Rust!

Another TUI based system monitor, this time in Rust!

Caleb Bassi 2.1k Dec 1, 2022
A user-friendly TUI client for Matrix written in Rust!

Konoha A user-friendly TUI client for Matrix written in Rust! Notice: The client is currently not usable and is only hosted on GitHub for version cont

L3af 9 Jan 5, 2022
TUI image viewer

Picterm TUI image viewer install $ cargo install picterm or $ git clone https://github.com/ksk001100/picterm $ cd picterm $ cargo install --path . usa

Keisuke Toyota 35 Nov 11, 2022
A cli prepared with TUI that facilitates your operations.

⚠️ For linux only ⚠️ Helper CLI A cli prepared with TUI that facilitates your operations. Click me to learn more about the theme system. If you just w

Yiğit 4 Feb 1, 2022
A tui to test regexes on the rust regex crate

regex-tui Structure src/ ├── app.rs -> holds the states and renders the widgets ├── event.rs -> handles the terminal events (key press, mouse cl

null 1 Oct 21, 2021
Parse hex colors to tui::style::Color

Color -> Tui Parse hex colors to tui rgb colors #c3f111 -> Color::Rgb(195,241,17) Note that the indexed colors are NOT HEX #142 -> Color::Indexed(142)

Uttarayan Mondal 1 Nov 8, 2021
2048 in `tui`, just for fun

TUI 2048 - Have a relax at anytime - ?? ^_^ How to run repo clone this repo, git clone https://github.com/WanderHuang/game-2048-tui.git cd game-2048-t

wander 42 Oct 9, 2022