Skip to content

Commit

Permalink
Merge pull request #388 from Demonthos/tui_docs
Browse files Browse the repository at this point in the history
change with_ctrl_c_quit to without_ctrl_c_quit for tui config
  • Loading branch information
jkelleyrtp committed May 2, 2022
2 parents b0f0041 + 99fea74 commit 1d42894
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions docs/reference/src/platforms/tui.md
Expand Up @@ -53,19 +53,17 @@ $ cargo run
Press "ctrl-c" to close the app. To switch from "ctrl-c" to just "q" to quit you can launch the app with a configuration to disable the default quit and use the root TuiContext to quit on your own.

```rust
// main
use dioxus::events::{KeyCode, KeyboardEvent};
use dioxus::prelude::*;
use dioxus::tui::TuiContext;

fn main() {
dioxus::tui::launch_cfg(
app,
dioxus::tui::Config {
ctrl_c_quit: false,
dioxus::tui::Config::new()
.without_ctrl_c_quit()
// Some older terminals only support 16 colors or ANSI colors if your terminal is one of these change this to BaseColors or ANSI
rendering_mode: dioxus::tui::RenderingMode::Rgb,
},
.with_rendering_mode(dioxus::tui::RenderingMode::Rgb),
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/tui/src/config.rs
Expand Up @@ -21,9 +21,9 @@ impl Config {
}
}

pub fn with_ctrl_c_quit(self) -> Self {
pub fn without_ctrl_c_quit(self) -> Self {
Self {
ctrl_c_quit: true,
ctrl_c_quit: false,
..self
}
}
Expand Down

0 comments on commit 1d42894

Please sign in to comment.