mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
change with_ctrl_c_quit to without_ctrl_c_quit
This commit is contained in:
parent
608795426a
commit
99fea74786
2 changed files with 5 additions and 7 deletions
|
@ -53,7 +53,6 @@ $ 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.
|
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
|
```rust
|
||||||
// main
|
|
||||||
use dioxus::events::{KeyCode, KeyboardEvent};
|
use dioxus::events::{KeyCode, KeyboardEvent};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus::tui::TuiContext;
|
use dioxus::tui::TuiContext;
|
||||||
|
@ -61,11 +60,10 @@ use dioxus::tui::TuiContext;
|
||||||
fn main() {
|
fn main() {
|
||||||
dioxus::tui::launch_cfg(
|
dioxus::tui::launch_cfg(
|
||||||
app,
|
app,
|
||||||
dioxus::tui::Config {
|
dioxus::tui::Config::new()
|
||||||
ctrl_c_quit: false,
|
.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
|
// 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),
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_ctrl_c_quit(self) -> Self {
|
pub fn without_ctrl_c_quit(self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
ctrl_c_quit: true,
|
ctrl_c_quit: false,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue