Giter Club home page Giter Club logo

tui-input's Introduction

tui-input

Crate Status Docs Status

tui-input.gif

A TUI input library supporting multiple backends.

This crate can be used with tui-rs and ratatui.

For people using tui-rs use version v0.6.* for people migrating to ratatui use latest version.

Install

Cargo.toml

# crossterm
tui-input = "*"

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

Features

  • crossterm (default)
  • termion
  • serde

Demo

See examples.

# Run the example with crossterm as backend.
cargo run --example crossterm_input

# Run the example with termion as backend.
cargo run --example termion_input --features termion

# Run the tui-rs example
(cd ./examples/ratatui-input/ && cargo run)

Used in

tui-input's People

Contributors

ckaznable avatar elvyria avatar sayanarijit avatar stevefan1999-personal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tui-input's Issues

Multi-line cursor support

Hey first just want to say thanks for this! :D I'm currently using this (crossterm) + ratatui to build a libcurl HTTP client, and it has served my purposes quite well so far.

In order to support adding larger JSON request bodies, I find myself in need of multi-line input/cursor support, and I was digging around in the crossterm docs and saw that they have cursor::MoveToNextLine and cursor::MoveToPreviousLine available in their API.
After some playing around I realize that unless I'm really missing something, implementing this as it stands would require a decent amount of change, obviouisly adding a Y coordinate to the cursor field of the main input struct.

I am currently having a go at implementing this, I was just curious if I get it working this might be a PR/change that you might be interested in?

One thing I will say is that I just now started really digging into this and it's also quite possible that I am missing a workaround or something similar

Bump crossterm to 26

Now that ratatui is out and supports crossterm 26, it would make sense to bump crossterm here.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.