A Text User Interface library for the Rust programming language

Overview

Cursive

crates.io Rust Build status (appveyor) MIT licensed Gitter chat

Cursive is a TUI (Text User Interface) library for rust. It uses ncurses by default, but other backends are available.

It allows you to build rich user interfaces for terminal applications.

Documentation

It is designed to be safe and easy to use:

[dependencies]
cursive = "0.16"

Or to use the latest git version:

[dependencies]
cursive = { git = "https://github.com/gyscos/cursive" }

(You will also need ncurses installed.)

use cursive::views::{Dialog, TextView};

fn main() {
    // Creates the cursive root - required for every application.
    let mut siv = cursive::default();

    // Creates a dialog with a single "Quit" button
    siv.add_layer(Dialog::around(TextView::new("Hello Dialog!"))
                         .title("Cursive")
                         .button("Quit", |s| s.quit()));

    // Starts the event loop.
    siv.run();
}

Cursive dialog example

Check out the other examples to get these results, and more:

edit.rs example lorem.rs example menubar.rs example select.rs example mines example theme.rs example

(Colors may depend on your terminal configuration.)

Tutorials

These tutorials may help you get started with cursive:

Third-party views

Here are a few crates implementing new views for you to use:

Showcases

Here are some cool applications using cursive:

  • RustyChat: Chat client made using Rust and Cursive.
  • clock-cli: A clock with stopwatch and countdown timer functionalities.
  • fui: Add CLI & form interface to your program.
  • git-branchless: Branchless workflow for Git.
  • grin-tui: Minimal implementation of the MimbleWimble protocol.
  • kakikun: A paint and ASCII art application for the terminal.
  • launchk: Manage launchd agents and daemons on macOS.
  • mythra: CLI to search for music.
  • ncspot: Cross-platform ncurses Spotify client.
  • ripasso: A simple password manager written in Rust.
  • rusty-man: Browse rustdoc documentation.
  • saci-rs: Simple API Client Interface.
  • so: A terminal interface for Stack Overflow.
  • sudoku-tui: Play sudoku on the command line.
  • wiki-tui: A simple and easy to use Wikipedia Text User Interface

Goals

  • Ease of use. Simple apps should be simple. Complex apps should be manageable.
  • Linux TTY Compatibility. Colors may suffer, and UTF-8 may be too much, but most features must work properly on a Linux TTY.
  • Flexibility. This library should be able to handle simple UI scripts, complex real-time applications, or even games.
    • In particular, it tries to have enough features to recreate these kind of tools:

Compatibility

First off, terminals are messy. A small set of features is standard, but beyond that, almost every terminal has its own implementation.

Output

  • Colors: the basic 8-colors palette should be broadly supported. User-defined colors is not supported in the raw linux TTY, but should work in most terminals, although it's still kinda experimental.
  • UTF-8: Currently Cursive really expects a UTF-8 locale. It may eventually get patched to support window borders on other locales, but it's not a priority. There is initial support for wide characters. RTL support is planned, but still very early.

Input

  • The key_codes example can be a useful tool to see how the library reacts to various key presses.
  • Keep in mind that if the terminal has shortcuts registered, they probably won't be transmitted to the app.
  • UTF-8 input should work fine in a unicode-enabled terminal emulator, but raw linux TTY may be more capricious.

Contributing

Alternatives

See also tui-rs - and a small comparison page.

Comments
  • Example program derived from linear.rs using decoupled UI

    Example program derived from linear.rs using decoupled UI

    Having time to spend I was toying with an idea the David Simmons offered in one of his blogs (https://cafbit.com/post/cursive_writing_terminal_applications_in_rust/). I took linear.rs and translated it into an mvc lookalike. Because I wanted to see keystrokes as well, I added 'q' and 'Q' to quit the example.

    Let me know if you think it is worth showing, or not. Any way, all praise goes to David Simmons and all critics belong to me alone :-).

    I renamed it mvc-linear to show the difference with linear.

    opened by gbonnema 40
  • Crossterm 0.14

    Crossterm 0.14

    A lot of changes have happened since 0.12, going to skip 0.13 and aim for the coming 0.14 in this PR. Which is going to have a very nice event reading system. People can use this branch if they want to be on the latest crossterm, however, the dependency branch is still a WIP, and changes can still happen and it might be broken sometimes. We do have settled on the public API. So I don't think anything is going to be changed about that.

    • Implemented back/foreground color support
    • Migrated 0.13 changes
    • Migrated 0.14 changes
    • Removed AsyncReader
    • Reordered trait methods
    • Implemented terminal reseize events
    • Cleaned up some code
    • Moved parsing logic into From trait implementations.
    opened by TimonPost 33
  • Investigate alternative backend

    Investigate alternative backend

    Ncurses is nice, but is pretty much terrible.

    Intersting alternatives currently include rustty and termion.

    First step would be to remove references to ncurses types from the public API (there's not a lot left).

    internals 
    opened by gyscos 24
  • Test backend

    Test backend

    I rewrote the test backend, I am starting slowly to write first tests ( https://github.com/njskalski/sly-editor/blob/master/src/file_dialog.rs ) figuring out what querying interface should look like. Any advice / constructive criticism appreciated.

    opened by njskalski 20
  • Absolute Position Layout

    Absolute Position Layout

    First: Suggestion / Help

    Problem description

    Context: I've got a toy re-implementation of React in Rust generating a Virtual DOM. It's already handling layout via Stretch. I'm trying to use Cursive as one 'DOM' backend to show a new novel use case of implementation.

    I'm trying to find the best method to absolute position the views according to my position/size information. Looks like it's not supported? Is my best bet to fork LinearLayout into an absolute view?

    Environment

    • Operating system: Windows
    • Backend used: crossterm
    • Current locale (run locale in a terminal). en_US.UTF-8
    • Cursive version 15
    opened by bgirard 18
  • [bug/terminator feature] cursive input ending up in 2x vi in different terminal

    [bug/terminator feature] cursive input ending up in 2x vi in different terminal

    When testing a change to an application using Cursive (the application is tupm of david simmons), I found the input that I put into the dialogs in my vi files (that were still open) between the rest of the code. As a terminal emulator I use terminator. I had two terminator windows open and the window1 contained two sub windows, each with one vi open on my code. Window2 was just one terminal window and was where I compiled and executed tupm.

    After testing my change, which was entering a new account, canceling and then entering a new account and saving, I found that the exact data I had input in the dialog, was in both of my vi sessions right in between the code! Plus the status line revealed a weird status "I-C-X" and a remark pertaining to a search of some sort.

    I have included screenprints here of both terminals. The code I was editing I will include in my github repo under gbonnema/tupm and branch separation.

    I have not repeated it yet, but I will after this issue and I will report on the result of it. You see my input for the dialogs in the vi windows in the lines with "gort x x x x" and the next one "madeup me thatissecret myown I just want to add an entry to the database.". The weird(er) thing is that the left vi session has the character "Add" prepended while the right vi session has the characters "impl" prepended to the second line (madeup).

    2019-04-12-cursive-into-vi-part-1 2019-04-12-cursive-into-vi-part-2

    My question for now is: is this a cursive thing, a ncurses thing or a terminator thing? I suspect the code in tupm has nothing to do with it, but I will commit the change to the separation branch.

    I hope you have some idea of what is going on here.

    Kind regards, Guus Bonnema.

    opened by gbonnema 17
  • error : note: ld: library not found for -lncursesw

    error : note: ld: library not found for -lncursesw

    hello

    i am on macos how to install that library to my system

    $ brew install ncurses Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae skinny

    Warning: homebrew/dupes/ncurses-6.0_2 already installed

    opened by adals 17
  • RFC/Announcement: cursive_hexview

    RFC/Announcement: cursive_hexview

    Hi everyone,

    for my project in needed some kind of displaying hexdata so I created a hexview which is accessable via https://github.com/hellow554/cursive_hexview

    Please, feel free to file any issues, pullrequests, doc changes, more cats pics, everything. I would really like to get some feedback, because it's my first published rust project.

    One particular thing I noticed is, that I can't use with_id or *_height/width methods on the view. What is necessary to be able to use them @gyscos ?

    Anyhow, you are welcome to use is, commend it, fork it, change it with any ideas you might have.

    opened by hellow554 15
  • Crossterm implementation for Cursive

    Crossterm implementation for Cursive

    This PR is implementing crossterm for Cursive. It is still a work in progress and has to be tested more. Down below you will find a list of thing that has to be checked or tested.

    • [X] Keyboard Input Handling
    • [X] Coloring
    • [x] Mouse input Handling
      • [X] Linux
      • [x] Windows (seems to not always capture mouse)
    • [x] Performance (Windows is a bit laggy sometimes)
    • [x] Cursor Hiding Windows.

    What is crossterm?

    Crossterm is similar to termion a terminal manipulation library, however, it supports all UNIX systems and Windows systems down to Windows 7.

    opened by TimonPost 14
  •  panicked at 'attempt to subtract with overflow'

    panicked at 'attempt to subtract with overflow'

    Hi,

    I ran into:

    thread 'main' panicked at 'attempt to subtract with overflow', /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/views/list_view.rs:229
    stack backtrace:
       1:     0x7fc581953f6c - std::sys::imp::backtrace::tracing::imp::write::hdc68b25dedcd1db8
       2:     0x7fc581952a7e - std::panicking::default_hook::{{closure}}::h5edd4f46e38f8310
       3:     0x7fc581952763 - std::panicking::default_hook::hda32855a02198554
       4:     0x7fc581952f0b - std::panicking::rust_panic_with_hook::hdd2e2d2d6c308562
       5:     0x7fc581952d54 - std::panicking::begin_panic::h48ad6352979e67f1
       6:     0x7fc581952cc9 - std::panicking::begin_panic_fmt::h2ded1b6830a36623
       7:     0x7fc581952c57 - rust_begin_unwind
       8:     0x7fc5819b1d6d - core::panicking::panic_fmt::h2aae0852c2562c9f
       9:     0x7fc5819b1ca4 - core::panicking::panic::h7f49eacfb0b4c1fc
      10:     0x55ec0df23aa8 - <cursive::views::list_view::ListView as cursive::view::View>::layout::h68ec5254d2a965f7
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/views/list_view.rs:229
      11:     0x55ec0de98ccc - cursive::view::view_wrapper::ViewWrapper::wrap_layout::h9e9d7de1055dca60
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:45
      12:     0x55ec0de9aa7f - cursive::view::view_wrapper::<impl cursive::view::View for T>::layout::h0437efaaaa52fd53
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:78
      13:     0x55ec0de98dac - cursive::view::view_wrapper::ViewWrapper::wrap_layout::hdeb15779bd802288
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:45
      14:     0x55ec0de9abff - cursive::view::view_wrapper::<impl cursive::view::View for T>::layout::had410b533505ca6d
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:78
      15:     0x55ec0df208ce - <cursive::views::linear_layout::LinearLayout as cursive::view::View>::layout::he430049eeb1c48a1
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/views/linear_layout.rs:201
      16:     0x55ec0de98bec - cursive::view::view_wrapper::ViewWrapper::wrap_layout::h5b2fd4995ac90378
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:45
      17:     0x55ec0de9acbf - cursive::view::view_wrapper::<impl cursive::view::View for T>::layout::hc245bd8e062c3d60
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:78
      18:     0x55ec0de64ad4 - <cursive::views::shadow_view::ShadowView<T> as cursive::view::view_wrapper::ViewWrapper>::wrap_layout::he941d882bcdabd4d
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/views/shadow_view.rs:58
      19:     0x55ec0de9ab9f - cursive::view::view_wrapper::<impl cursive::view::View for T>::layout::h7bb1fefbf58cdf4a
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/view/view_wrapper.rs:78
      20:     0x55ec0df29ed9 - <cursive::views::stack_view::StackView as cursive::view::View>::layout::h7de8e74d223fe846
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/views/stack_view.rs:154
      21:     0x55ec0df356ba - cursive::Cursive::layout::h593ae75221da9ba7
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/lib.rs:494
      22:     0x55ec0df35df5 - cursive::Cursive::step::hc789d40ea1a7d171
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/lib.rs:570
      23:     0x55ec0df35c8f - cursive::Cursive::run::ha463ea6606b82047
                            at /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-0.4.1/src/lib.rs:552
      24:     0x55ec0deae19f - rikki::frontend::curses::start::h0dcd081ef2d42d16
                            at /home/m/archive/code/rust/rikki/src/frontend/curses/mod.rs:38
      25:     0x55ec0deae761 - rikki::main::heea4d07080c68991
                            at /home/m/archive/code/rust/rikki/src/main.rs:84
      26:     0x7fc581961567 - __rust_maybe_catch_panic
      27:     0x7fc58195b667 - std::rt::lang_start::h667ad30118861e80
      28:     0x55ec0deb3a12 - main
      29:     0x7fc57fa2752f - __libc_start_main
      30:     0x55ec0de62759 - _start
                            at ../sysdeps/x86_64/start.S:120
      31:                0x0 - <unknown>
    

    Anything I can do about it?

    bug views 
    opened by matthiasbeyer 14
  • Prints garbages instead of nice borders

    Prints garbages instead of nice borders

    I was following the tutorial, part 2, and got the following: cursive_tut2_error I use: $ rustc --version rustc 1.11.0 (9b21dcd6a 2016-08-15) $ gnome-terminal --version GNOME Terminal 3.18.3 $ echo $LANG en_US.UTF-8

    Any ideas why I got these garbages?

    opened by trojczak 14
  • [FEATURE] StackView shouldn't layout and draw hidden layers

    [FEATURE] StackView shouldn't layout and draw hidden layers

    Is your feature request related to a problem? Please describe. StackView lays out and draws all layers, even if they are not visible. If you have a Stack of a bunch of fullscreen layers, it doesn't make any sense to layout and draw any but the front layer. However, StackView always calls layout/draw on all layers. You need a custom view and some hacks (like checking if the printer is focused in draw) to avoid this.

    Describe the solution you'd like StackView should be clever enough to not call layout/draw on layers that are not being shown.

    Describe alternatives you've considered As above, custom views can hack around this.

    opened by nicklan 0
  • [FEATURE] Ability to clear SelectView's selection and focus

    [FEATURE] Ability to clear SelectView's selection and focus

    Is your feature request related to a problem? Please describe. I have a few specific events that basically invalidate any selections/focus in my SelectViews. These are cumbersome to handle with the current available access to SelectView.

    Describe the solution you'd like .clear_selection() that would get rid of any selections/focus made, meaning no selection is highlighted (even when focus has already been lost) and no selection is returned by .selection().

    Describe alternatives you've considered Right now I resorted to .clear() and rebuilding the view, but that's a waste if I could just call a function to clear any selections/focus made in SelectViews.

    opened by TaaviE 0
  • [BUG] Views not visible (or hidden) slow ScrollView down significantly

    [BUG] Views not visible (or hidden) slow ScrollView down significantly

    Describe the bug I think ScrollView slows down exponentially based on the content inside, even if that content isn't visible, or is hidden.

    To Reproduce I have this layout hierarchy right now (naming excluded):

    > ResizedView
        > LinearLayout
            > PaddedView (header)
               > TextView
               > HideableView (hidden)
                   > ScrollView
                       > DebugView
               > HideableView (hidden)
                   > ScrollView
                       > LoggerView
            > ResizedView
              > AlignedView
                 > ScrollView
                     > LinearLayout
                         > PaddedView
                            > TextView
    ** Repeating element **
                     > LinearLayout (one section containing a title and a list of (expandable) items)
                         > TextView (section header basically)
                         > HideableView (might be hidden)
                             > ScrollView
                                 > ListView
                                     > TextView
    ** Repeating element **
        > PaddedView (footer)
            > TextView
    

    Expected behavior Faster draws if only 40 lines of text are actually displayed, and approximately 1000 in all the visible views.

    Environment

    • Operating system used: Ubuntu 22.04
    • Backend used: crossterm
    • Current locale: en_GB.UTF-8
    • Cursive version: 0.20.0 (crates.io)
    bug 
    opened by TaaviE 4
  • [BUG] `scroll_to_bottom()` scrolls to one line above the bottom with default scroll strategy

    [BUG] `scroll_to_bottom()` scrolls to one line above the bottom with default scroll strategy

    Consider the following code:

    use cursive::traits::{Nameable, Resizable, Scrollable};
    use cursive::views::{EditView, LinearLayout, ScrollView, TextView};
    use cursive::Cursive;
    
    fn main() {
        let mut siv = cursive::default();
        siv.add_fullscreen_layer(
            LinearLayout::vertical()
                .child(
                    LinearLayout::vertical()
                        .scrollable()
                        .with_name("chatbox")
                        .full_height(),
                )
                .child(
                    EditView::new()
                        .on_submit(sendtext)
                        .with_name("input")
                        .full_width(),
                ),
        );
        siv.run();
    }
    
    fn sendtext(s: &mut Cursive, line: &str) {
        s.call_on_name("chatbox", |view: &mut ScrollView<LinearLayout>| {
            view.get_inner_mut().add_child(TextView::new(line));
            view.scroll_to_bottom()
        });
        s.call_on_name("input", |view: &mut EditView| view.set_content(""));
    }
    

    My expectation is that, once enough lines have been submitted to fill up "chatbox", submitting another line will lead to that new line being visible on the row immediately above "input" due to the call to view.scroll_to_bottom(). In actuality, once "chatbox" is full, like so:

    Screen Shot 2022-11-18 at 18 45 38

    entering another line ("Line 24") will result in that new line being below the current-displayed portion of the ScrollView:

    Screen Shot 2022-11-18 at 18 45 46

    If another line ("Line 25") after that is entered, Line 24 will become visible, but Line 25 will remain unshown:

    Screen Shot 2022-11-18 at 18 45 56

    And likewise after entering Line 26:

    Screen Shot 2022-11-18 at 18 46 10

    If "chatbox" is then manually scrolled to the bottom (producing the visual result I expected in the first place):

    Screen Shot 2022-11-18 at 18 46 23

    Entering another line will return it to the old behavior:

    Screen Shot 2022-11-18 at 18 46 31

    Unlike #651, scroll_to_bottom() is indeed doing something, as removing that line results in the ScrollView never scrolling down no matter how many new lines are added.

    Environment

    • Operating system used: macOS 11.6.8, using GNU screen 4.09.00 (TERM=screen-256color) inside Terminal.app (TERM=xterm-256color)
    • Backend used: ncurses
    • Current locale:
    LANG="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_ALL="en_US.UTF-8"
    
    • Cursive version: 0.20.0 from crates.io
    bug 
    opened by jwodder 2
  • [FEATURE] Detect name collisions

    [FEATURE] Detect name collisions

    Is your feature request related to a problem? Please describe. At this point in time, cursive does not detect when multiple views are given the same name. Puzzling debugging sessions may ensue as call_on_name calls reach the wrong target.

    Describe the solution you'd like Cursive should detect this API usage error and handle it. Panicking would most likely be appropriate here.

    Describe alternatives you've considered

    • APIs that name views, such as Nameable::with_name, could return a type that can handle the possibility of error, such as an Option or Result.
    • These APIs could automatically generate derived names e.g. "RequestedName#123" and return that when a requested name is already taken.
    • Usage of user-defined names could be replaced by collision-free alternatives, such as 64-bit integers generated by a global atomic counter.

    However, I think this is too much of an edge case to justify expending so much implementation care and/or API surface on it.

    opened by HadrienG2 3
  • [BUG] Terminal unresponsive when using Cursive with crossterm-backend and echo

    [BUG] Terminal unresponsive when using Cursive with crossterm-backend and echo

    (UPDATE: The bug is due to https://github.com/crossterm-rs/crossterm/issues/500 and there is work in progress to fix it at https://github.com/crossterm-rs/crossterm/pull/711)

    The bug seems to be unique to the crossterm-backend, so I'm reporting the bug here: https://github.com/crossterm-rs/crossterm/issues/725

    The rest of this text is copy/paste from the link above.

    Describe the bug

    Terminal is unresponsive when using Crossterm and Cursive, when enabling Cursive feature crossterm-backend.

    Specifically, Cursive launches the TUI, but it doesn't respond to key presses.

    For comparison, the same app works fine with other Cursive backends, including ncurses, pancurses, termion.

    To Reproduce

    Minimal reproduction code.

    File Cargo.toml includes:

    [dependencies]
    cursive = { version = "*", features = ["crossterm-backend"] }
    

    File main.rs:

    fn main() {
        let mut c = cursive::crossterm();
        c.run();
    }
    

    Run:

    ./target/debug/demo
    

    Cursive shows a blank screen, as expected.

    Press ctrl-c to exit, as expected.

    Run:

    echo "" | ./target/debug/demo
    

    Cursive shows a blank screen, as expected.

    Press ctrl-c to exit-- but it doesn't work. This is the bug. A real-world app with more kinds of inputs has all of the fail, such as for Checkbox, EditView, tec.

    Expected behavior

    Expected: Cursive responds to keys.

    Actual: Cursive does not responds to keys.

    I've confirmed this problem happens with other kinds of UI/UX, such as other keypresses, and also by using other Cursive functionality, such as a TextView, or EditView, or Button, etc.

    OS

    macOS Ventura 13.0 on a MacBook Pro with Apple M1 Max chip

    Terminal/Console

    macOS Terminal app i.e. the default macOS terminal application

    Question

    When the Crossterm documentation states "It supports all UNIX and Windows terminals down to Windows 7", does Crossterm currently support UNIX on macOS with Apple M1? I ask because I see some past posts that discuss Crossterm macOS M1 issues/incompatibilities/roadmaps.

    If yes, then what's the next step please, to troubleshoot this bug?

    If no, then could a maintainer edit to the README and documentation to note that Crossterm is currently not intending to be run on macOS with Apple M1?

    Thank you for your consideration.

    bug 
    opened by joelparkerhenderson 4
Releases(cursive_core-v0.1.1)
  • cursive_core-v0.1.1(Jul 6, 2020)

    cursive-core 0.1.1

    API updates

    • Add Dialog::into_content.
    • Add Callback::from_fn_once and once1! macro to wrap a FnOnce in a FnMut.
    • Add FixedLayoutView with manual placement of child views.
    • Add OnLayoutView to override View::Layout
    • Add Cursive::{dump, restore} to save and load the global state.
    • Add NamedView::{name, set_name} to retrieve or replace the given name.
    • Add LinearLayout::find_child_with_name.
    • Add ScrollView::on_scroll callback.
    • Add once1! macro to turn a FnOnce into FnMut.
    • Implement Default for some wrapper views where the child is Default.

    Bugfixes

    • More hygienic wrap_impl! macro using fully-qualified paths.
    • Fixed LinearLayout giving children incorrect sizes.
    • More accurate "important area" for ShadowView and PaddedView.
    • Fix potential panic when calling TextArea::set_cursor before its first layout phase.
    • Disabled views no longer accept input if they are still in focus.
    Source code(tar.gz)
    Source code(zip)
  • cursive-v0.15.0(Jun 30, 2020)

    Breaking changes

    • Split library into a backend-agnostic cursive-core and a user-facing cursive.
    • Cursive::default now needs the cursive::CursiveExt trait to be in scope.
    • Update dependencies:
      • crossterm to 0.17.
      • enumset to 1.0
      • ahash to 0.3
      • pulldown-cmark to 0.7
    • Add PaletteColor::HighlightText
    • AnyCb now takes a &mut dyn View rather than a &mut dyn Any.

    API updates

    • Added cursive::{default,ncurses,pancurses,termion,crossterm,blt,dummy} functions.
    • Add Cursive::debug_name
    • Add ScreensView to move some code away from the Cursive root
      • Reworked global callbacks configuration
      • Ctrl-C can be rewired to no longer exit the application
    • Add SelectView::(try_)iter_mut()
    • Dialog::{test, info} now accept StyledString as input
    • Add missing functions to Checkbox re: enabled state

    Bugfixes

    • Fix Ctrl-Z binding for ncurses
    • Fix potential crash with empty SelectView
    • Add toml and markdown features to docs.rs
    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Jan 14, 2020)

    Breaking changes

    • cursive::event::AnyCb changed from Box<...> to &mut ..., so users of View::call_on_any no longer need to box their closures.
    • Remove BoxView::squishable.
    • Update crossterm to 0.14.
    • Removed From implementations for Margins. Use Margins::lrtb and the like instead.
      • Or Dialog::padding_lrtb.
    • Renamed multiple types (old names are still re-exported, but deprecated):
      • BoxView -> ResizedView
      • ViewBox -> BoxedView
      • SizedView -> LastSizeView
      • Identifiable -> Nameable
      • Boxable -> Resizable
      • IdView -> NamedView
      • Selector::Id -> Selector::Name
      • with_id -> with_name
      • call_on_id -> call_on_name
      • find_id -> find_name
      • focus_id -> focus_name

    API updates

    • SelectView::{item, with_all} now accept S: Into<StyledString> for colored labels.
    • Add ScrollView::scroll_to_important_area.
    • Add LinearLayout::set_focus_index.
    • Add XY::{sum, product}.
    • view::scroll is now a public module.
    • Add Cursive::process_events and Cursive::post_events.
      • This gives users finer control than Cursive::step.
    • Layer now has a color option.
    • LinearLayout can now directly add boxed views without re-boxing.
    • Add inner getters to EnableableView.
    • Add PaddedView::get_inner(_mut).
    • Add a bunch of constructors for Margins.
    • Add Dialog::padding_lrtb
    • Add Dialog::set_padding*
    • Add PaddedView::lrtb

    Improvements

    • Changed the default color for TitleSecondary from yellow to light blue.
    • Changed the default color for Tertiary from grey to white.
    • Reduced dependencies (toml is now optional, removed hashbrown).
    • Cursive::default() now fallbacks do dummy backend if no other is available.

    Bugfixes

    • Fixed ScrollView::show_scrollbars().
    • Correctly update the offset for ScrollView after focus change.
    • Fixed layout for BoxView with some size constraints.
    • On Windows, do not print unix-specific character during initialization.
    • Fix out-of-bounds access for some mouse events in MenuPopup
    Source code(tar.gz)
    Source code(zip)
  • v0.13.0(Jan 14, 2020)

    Breaking changes

    • Update enum-map fron 0.5 to 0.6

    API updates

    • Add Effect::Strikethrough (not supported on ncurses)
    • Add ListView::remove_child
    • Replace xursive::CbFunc with Box<FnOnce>
    • Add ScrollView::{inner_size, is_as_{bottom, top, left, right} }
    • Add getters for current value in SliderView
    • More fields made public in cursive::logger
    • Add a "puppet" backend for testing and instrumentation

    Improvements

    • Performance improvements for the crossterm backend

    Bugfixes

    • Fix a possible panic when a TextView is updated asynchronously while it's being layed out.
    • Fixed weird behaviour of SizeConstraint::Full with ScrollView.
    Source code(tar.gz)
    Source code(zip)
  • 0.12.0(May 9, 2019)

    Breaking changes

    • Updated enumset from 0.3 to 0.4

    API updates

    • Add Cursive::take_user_data, replaces the current user data with ().

    Improvements

    • DebugConsole now has horizontal scrolling enabled.
    • pancurses backend now correctly recognizes the "Enter" key from the numpad as "Enter".
    Source code(tar.gz)
    Source code(zip)
  • 0.11.2(Apr 18, 2019)

    API updates

    • Add a new backend based on the crossterm library.
    • Bring back Cursive::set_fps for <30Hz refresh rates.
    • Add Cursive::backend_name to get the name of the current backend.
    • Add direct downcast methods to dyn AnyView
    • Add sort methods to SelectView

    Improvements

    • Improved printer performance with styled spans.
    Source code(tar.gz)
    Source code(zip)
  • 0.11.1(Mar 16, 2019)

    API updates

    • Added manual scrolling methods to view::scroll::Core:
      • keep_in_view, scroll_to, scroll_to_x, scroll_to_y Note: the view::scroll module is hidden behind an experimental feature unstable_scroll.

    Improvements

    • Improved printer performance (thanks to @chrisvest).

    Bugfixes

    • Fixed MenuPopup borders near delimiters.
    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Mar 16, 2019)

    Breaking changes

    • Cursive::{ncurses, pancurses, termion} now return io::Result<Self> instead of panicking. Cursive::default() still unwraps.
      • Also added Cursive::try_new for failible backends.
    • Replaced set_fps(i32) with set_autorefresh(bool)
    • Finder::find_id() is renamed to call_on_id(), and a proper find_id() was added instead.
    • Updated the Backend trait for a simpler input system
    • Updated to Rust 2018 edition (now requires rustc > 1.31)
    • Cursive::clear() now takes &mut self

    API updates

    • Add a logging implementation (logger::init()) and a DebugConsole (cursive::toggle_debug_console())
    • Add user-data to Cursive.
      • Cursive::set_user_data() can store some user-defined data structure.
      • Cursive::user_data() and Cursive::with_user_data() can be used to access the data.
    • Add StackView::remove_layer()
    • Add CircularFocus view (and bring proper circular focus to dialogs)
    • Add HideableView::is_visible()
    • Add type CbSink = Sender<Box<CbFunc>> as an alias for the return type of Cursive::cb_sink()
    • Add LinearLayout::{insert_child, swap_children, set_weight} for more in-place modifications.
    • Add Printer::{cropped_centered,shrinked_centered}

    Improvements

    • Updated termion backend to use direct /dev/tty access for improved performance.
    • Enabled raw mode for ncurses and pancurses. Among other improvements, this lets applications receive Ctrl+S and Ctrl+Q events.

    Bugfixes

    • Fixed overflow check for titles in Dialog and Panel
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Dec 1, 2018)

    • Add EventTrigger and update OnEventView to use it
      • Breaking change: "inner" callbacks for OnEventView now take the event as extra argument.
    • Add Printer::enabled and EnableableView to disable whole subtrees
    • Add PaddedView to add padding around any view
    • Add RadioGroup::on_change to set a callback on selection change
    • Use styled strings in SelectView
      • Breaking change: SelectView::get_item_mut now returns a Option<(&mut StyledString, &mut T)>
    • Fix mouse events on Ubuntu
    • Add doc tests/examples to XY and Vec2
    Source code(tar.gz)
    Source code(zip)
  • 0.9.2(Nov 5, 2018)

    • Add immut! family of macros to wrap a FnMut in a Fn
    • SelectView: autojump (jump to an item when a letter is pressed) is now opt-in
    • Panel can now have a title
    • Fixed layout bug with SelectView and ListView.
    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Sep 17, 2018)

    New features

    • Add Cursive::on_event to send simulated events.
    • Add EventResult::and to combine callbacks.
    • Allow custom color in ProgressBar.

    Bugfixes

    • LinearLayout:
      • Better geometry computation with constrained size
      • Fixed cache invalidation
      • Fix possible panic when removing children
    • ScrollView:
      • Fix possible panic with full-height scrollbar
      • Fix possible panic with empty content
      • Fix cache
    • Fix menubar focus after action
    • Pin enumset version (fix compilation error)
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Jul 26, 2018)

    This releases is quite large and includes some breaking changes:

    • Cursive::new() has been renamed Cursive::default(). Cursive::new is now used to select a backend, allowing third-party backends.
    • Scrolling is now handled by a new view wrapper, ScrollView. For TextView, SelectView and ListView, it is opt-in, by wrapping it in a ScrollView or calling .scrollable() from the Scrollable trait.
    • Cursive::cb_sink() now returns a crossbeam_channel::Sender instead of chan::Sender. The API is mostly similar.
    • SelectView::selection now returns a Option<Rc<T>> instead of panicking on an empty list.
    • The features of AnyView have been merged into the regular View, so you should not need to use AnyView directly, and can only use View.
    • Vec4 has been renamed to Margins.

    In addition, many non-breaking changes are present as well:

    • Callbacks sent through Cursive::cb_sink() are now processed instantly, without the need for set_fps.
    • Backends are now a dynamic choice rather than a comile-time selection.
      • This means library do not need to bother with backend features anymore
      • Features are still there to add available backends, but they are mutually compatible.
    • Events are batch-processed, resulting in higher performance when a lot of events are sent at once (for instance when scrolling with the mouse).
    • Some methods now return a callback:
      • SelectView::{set_selection, select_up, select_down, remove_item}
      • EditView::{set_content, insert, remove}
    • API additions:
      • StackView::find_layer_from_id
      • SelectView::insert_item
      • TextArea::{enable, disable}
      • rect::Rect
    • Various bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 0.8.2(Jul 26, 2018)

  • 0.8.1(Mar 11, 2018)

    • Add Cursive::clear_global_callbacks
    • Bugfixes:
      • Fix non-ASCII input with pancurses backend
      • Fix StackView::move_layer
      • Fix layout computation for SelectView
      • Remove unused maplit dependency for termion and blt backends
    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Feb 20, 2018)

    Major update. Check CHANGELOG.md for complete list.

    Highlights:

    • Add styled text support.
      • TextView can now display a StyledString. A StyledString can be built from multiple sources, including parsing markdown text.
    • Fixed line-breaking algorithm (now doesn't break at invalid locations).
    • Refactored ColorStyle.
    • Added TextContent to manage the content from a TextView remotely.
    • StackView: added methods to re-order the layers, and reposition them on screen.
    • Cursive::cb_sink can now accept FnOnce callbacks
    • Various methods were added to query/update the selection/focus for most views.
    • Usual bunch of bugfixes.
    Source code(tar.gz)
    Source code(zip)
  • 0.7.5(Dec 8, 2017)

    • Add mouse support to pancurses
    • Better key modifier detection on ncurses backend
    • Fix possible panic in TextArea::set_content
    • Add TextArea::cursor(&self) -> usize and TextArea::set_cursor(&mut self, usize)
    • Use Vec::splice instead of VecExt from the odds crate. This may require rustc > 1.21
    Source code(tar.gz)
    Source code(zip)
  • 0.7.4(Nov 17, 2017)

  • 0.7.3(Nov 17, 2017)

  • 0.7.2(Oct 15, 2017)

  • 0.7.1(Oct 14, 2017)

  • 0.7.0(Oct 13, 2017)

    • Adds mouse support (except pancurses backend for now)
    • Adds a ViewWrapper implementation (and therefore an automatic View implementation) for any type that implements DerefMut<Target: View> - this means View is automatically implemented for &mut View, Box<View> ...
    • Adds Canvas::wrap(View): this allow to wrap a view and easily override some of its methods.
    • Fixes some modifiers detection in ncurses backend
    Source code(tar.gz)
    Source code(zip)
  • 0.6.4(Oct 13, 2017)

  • 0.6.3(Aug 14, 2017)

    • Added methods:
      • XY<usize>::saturating_sub()
      • XY<usize>::checked_sub()
      • XY<usize>::signed(self) -> XY<isize>
      • XY<O: Ord>::fits as a reverse of XY<O: Ord>::fits_in.
    • Fixes some unchecked subtraction (they could cause panics in some cases).
      • Fixed #148 .
    Source code(tar.gz)
    Source code(zip)
  • 0.6.2(Aug 3, 2017)

  • 0.6.1(Jul 20, 2017)

    • Add Color::TerminalDefault and ColorStyle::TerminalDefault, to use the terminal's default colors (background and font color used outside of cursive).
    • Fix a scroll bug with some TextAreas.
    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Jul 4, 2017)

    • Breaking change: Rename KeyEventView to OnEventView
    • Fix possible panic when using Cursive::find_id (#114).
    • Add ColorStyle::Custom to allow use of colors outside of palette.
    • Add Button::set_callback
    • Add methods to access ListView's children
    • Fix locale issue with ncurses
    • Enable multiple successive calls to Cursive::run (for multiple event loop segments)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(May 16, 2017)

    • Explicitly call odds::vec::VecExt::splice
      • Fix compilation for rust 1.17
    • Add auto-sizing to TextArea
    • Allow colored EditView with EditView::set_style
    • Termion: use alternate screen to return the screen to normal after exiting the application
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Mar 29, 2017)

    • Refactored view indexing:
      • Cursive::find_id now returns a ViewRef, which provides DerefMut but isn't tied to the lifetime of the Cursive root, allowing more natural access.
      • Added Cursive::call_on_id which takes a closure to run on the target view.
    • Add mutable on_edit callback to EditView
    • event::Event::Unknown now carries the unknown bytes rather than an integer.
    • event::Event is therefore no longer Copy
    • Add Cursive::focus_id to move the focus to the target view.
    • Bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 0.4.1(Feb 9, 2017)

    • Rename features to *-backend
      • This helps fix building on Windows platform
    • Renamed utils::prefix_length -> utils::prefix (and also return the width)
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jan 24, 2017)

    • Add Canvas view
    • Made TextView easier to use when appending content
      • Added TextView::append_content()
      • Added ScrollStrategy to control scroll behavior on content change.
    • Made Menubar easier to use with dynamic content
      • Added methods to clear and edit menu trees
    • Add "real" fullscreen views to StackView
    • Rename View::get_min_size -> View::required_size
    • Fix off-by-1 error in termion backend
    Source code(tar.gz)
    Source code(zip)
Owner
Alexandre Bury
Alexandre Bury
A cross platform minimalistic text user interface

titik Titik is a crossplatform TUI widget library with the goal of being able to interact intuitively on these widgets. It uses crossterm as the under

Jovansonlee Cesar 113 Dec 31, 2022
An implementation of Piet's text interface using cosmic-text

piet-cosmic-text Implements piet's Text interface using the cosmic-text crate. License piet-cosmic-text is free software: you can redistribute it and/

John Nunley 7 Mar 12, 2023
An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

Syed Vilayat Ali Rizvi 7 Mar 31, 2023
A C-like programming language that is similar to Rust's syntax. Toy programming language.

CRUST This is a hobby project to learn about compilers and language design. I've designed the language to be similar to C and Rust. Heavily inspired b

Mahmoud Almontasser 50 Jul 13, 2024
A library for building declarative text-based user interfaces

Intuitive docs.rs Documentation Intuitive is a component-based library for creating text-based user interfaces (TUIs) easily. It is heavily inspired b

Enrico Borba 205 Dec 29, 2022
A text and (will be) graphic programming language

Siren Language I'm trying to make a simple programming language called Siren Language. This language will become a graphic and text programming langua

LTstrange 3 Jul 16, 2023
Demo Rust Cursive crate for terminal user interface (TUI)

Demo Rust Cursive Demonstration of the Rust programming language and Cursvie crate for terminal user interface (TUI). Setup Create: cargo new demo Add

Joel Parker Henderson 5 Dec 27, 2022
ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust

ChatGPT-rs is a lightweight ChatGPT client with a graphical user interface, written in Rust. It allows you to chat with OpenAI's GPT models through a simple and intuitive interface.

null 7 Apr 2, 2023
a terminal user interface for lemmy

Lemmy-Terminal-Viewer Terminal User Interface for lemmy for Linux Terminals (should work in MacOs but i can't test) Install and Usage Linux Download l

Luna 21 Oct 29, 2022
OSINT from your favorite services in a friendly terminal user interface

osintui Open Source Intelligence Terminal User Interface Report Bug · Request Feature Installation First, install Rust (using the recommended rustup i

Will Sheldon 639 Jan 4, 2023
Terminal User Interface to help debugging programs written for Triton VM.

Triton TUI Terminal User Interface to run and debug programs written for Triton VM. Getting Started Triton TUI tries to be helpful. ?? List possible (

Triton VM 4 May 7, 2024
Programming language made by me to learn other people how to make programming languages :3

Spectra programming language Programming language made for my tutorial videos (my youtube channel): Syntax Declaring a variable: var a = 3; Function

Adi Salimgereyev 3 Jul 25, 2023
The Amp programming language: a language designed for building high performance systems.

A language designed for building high performance systems. Platform Support x86_64-pc-windows ✅ x86_64-unknown-linux ⚠️ untested x86_64-unknown-darwin

The Amp Programming Language 5 Mar 17, 2023
Nexa programming language. A language for game developers by a game developer

NexaLang Nexa programming language. A language for game developers by a game developer. Features High-Level: Nexa is an easy high level language Two M

Sabe 3 Aug 21, 2023
tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks

tmplt A User Friendly CLI Tool For Creating New Projects With Templates About tmplt is a command-line tool that lets users quickly create new projects

Humble Penguin 35 Apr 8, 2023
Slack chat bot written in Rust that allows the user to interact with a large language model.

A Slack chat bot written in Rust that allows the user to interact with a large language model. Creating an App on Slack, first steps Go to https://api

Marco Inacio 13 Nov 2, 2023
Text-based to-do management CLI & language server

☑️ Todome (日本語版はこちら) Todome is a notation developed for making and editing to-do lists. It is inspired by Todo.txt, and in fact some of the todome not

monaqa 16 Aug 17, 2022
Attempt to summarize text from `stdin`, using a large language model (locally and offline), to `stdout`

summarize-cli Attempt to summarize text from stdin, using a large language model (locally and offline), to stdout. cargo build --release target/releas

null 4 Aug 23, 2023
Putting a brain behind `cat`🐈‍⬛ Integrating language models in the Unix commands ecosystem through text streams.

smartcat (sc) Puts a brain behind cat! CLI interface to bring language models in the Unix ecosystem and allow power users to make the most out of llms

Emilien Fugier 28 Dec 2, 2023