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
A template for bootstrapping a Rust TUI application with tui-rs & crossterm

rust-tui-template A template for bootstrapping a Rust TUI application with tui-rs & crossterm. tui-rs The library is based on the principle of immedia

Orhun Parmaksız 72 Dec 31, 2022
A beautiful, tiny traceback and logging library supporting #![no_std] rust.

breadcrumbs Breadcrumbs is a beautiful, tiny traceback and logging library for Rust that offers seamless integration with #![no_std], multi-threading

Michael 18 Nov 21, 2023
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 215 Dec 30, 2022
Supporting code for the paper "Optimized Homomorphic Evaluation of Boolean Functions" submitted to Eurocrypt 2024

This repository contains the code related to the paper Optimized Homomorphic Evaluation of Boolean Functions. The folder search_algorithm contains the

CryptoExperts 3 Oct 23, 2023
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 189 Dec 27, 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 Dec 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 4 Dec 4, 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 Dec 31, 2022
INput maCROs: program your keyboard/mouse

incro INput maCROs: program your keyboard/mouse See macro-template for macro example. Build it and place the resulting *.so file in macros/ directory

Mykolas Peteraitis 6 Nov 13, 2023
Detects Linux input, notifies with bell sound

Keypress Notifier keypress-notifier는 리눅스에서 동작하는 입력 이벤트 감지 및 벨 소리 알림 프로젝트입니다. 소개 keypress-notifier는 Rust 언어로 개발되었으며, 키패드, 마우스 등의 입력 이벤트를 감지하고, 벨 소리로 사용

인준 4 Feb 15, 2024
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 8 Dec 15, 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
Spawn multiple concurrent unix terminals in Discord

Using this bot can be exceedingly dangerous since you're basically granting people direct access to your shell.

Simon Larsson 11 Jun 1, 2021
🌌⭐cosmo is a wrapper for Git essentially, allowing you to compress multiple commands into one

❯ Cosmo Git tooling of the future New feature: Cosmo hooks! Click here for more info! ❯ ?? Features Config files (with defaults!) Fast Easy to use Fri

Jack 1 Oct 31, 2021
Nvm - Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Node Version Manager Table of Contents Intro About Installing and Updating Install & Update Script Additional Notes Troubleshooting on Linux Troublesh

nvm.sh 63.8k Jan 7, 2023
CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a plotable format.

Lighthouse Aggregator CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" f

Polestar 1 Jan 12, 2022