From 751ed0485e3ada7a1fe85b54eea815921c79c84f Mon Sep 17 00:00:00 2001 From: structix Date: Mon, 25 Mar 2024 14:32:02 +0100 Subject: [PATCH] Exit with ctrl m --- src/userinterface.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/userinterface.rs b/src/userinterface.rs index b23cb53..d9116c4 100644 --- a/src/userinterface.rs +++ b/src/userinterface.rs @@ -7,6 +7,7 @@ use ratatui::layout::{Constraint, Layout}; use ratatui::style::{Color, Style}; use ratatui::widgets::{Block, Borders}; use ratatui::Terminal; +use std::process::exit; use std::{i64, io}; use tui_textarea::{Input, Key, TextArea}; @@ -104,10 +105,7 @@ pub async fn get_user_rating(db: &Database) -> Result<(i64, i64)> { key: Key::Char('m'), ctrl: true, .. - } - | Input { - key: Key::Enter, .. - } => {} + } => exit(0), input => { // TextArea::input returns if the input modified its text if textarea.input(input) { @@ -142,10 +140,7 @@ pub async fn get_user_rating(db: &Database) -> Result<(i64, i64)> { key: Key::Char('m'), ctrl: true, .. - } - | Input { - key: Key::Enter, .. - } => {} + } => exit(0), input => { // TextArea::input returns if the input modified its text if textarea.input(input) {