allow to enter record msg
[?]
Feb 15, 2025, 7:22 PM
S2NVIFXRFER4SRA37WCT5XTXHDHAL5WIGGKY4A4XOTPLTKTZSRGQCDependencies
- [2]
IQDCHWCPload a pijul repo - [3]
SWWE2R6Mdisplay basic repo stuff - [4]
WT3GA27Padd cursor with selection - [5]
UB2ITZJSrefresh changed files on FS changes - [6]
ELG3UDT6allow to rm added files - [7]
KT5UYXGKfix selection after adding file, add changed file diffs - [8]
EC3TVL4Xadd untracked files - [9]
6YZAVBWUInitial commit
Change contents
- replacement in crates/flowers_ui/src/main.rs at line 5
use iced::widget::{button, column, horizontal_rule, row, text};use iced::widget::{button, column, horizontal_rule, row, text, text_editor}; - edit in crates/flowers_ui/src/main.rs at line 62
record_msg: None, - edit in crates/flowers_ui/src/main.rs at line 73
record_msg: Option<text_editor::Content>, - edit in crates/flowers_ui/src/main.rs at line 88
Record,EditRecordMsg(text_editor::Action),Save, - edit in crates/flowers_ui/src/main.rs at line 304
}}Message::Record => {if state.record_msg.is_some() {println!("Already recording");} else if state.repo.changed_files.is_empty() {println!("Trying to record with no changed file");} else {state.record_msg = Some(text_editor::Content::new()); - edit in crates/flowers_ui/src/main.rs at line 315
Message::EditRecordMsg(action) => {if let Some(record_msg) = state.record_msg.as_mut() {record_msg.perform(action);}}Message::Save => match state.record_msg.as_ref() {None => {println!("Not recording");}Some(record_msg) => {let text = record_msg.text();if text.chars().all(|c| c.is_whitespace()) {println!("Message cannot be empty");} else {state.record_msg = None;// TODO: use the text to make a record}}}, - replacement in crates/flowers_ui/src/main.rs at line 338
use iced::keyboard::{on_key_press, Key};use iced::keyboard::{on_key_press, Key, Modifiers}; - edit in crates/flowers_ui/src/main.rs at line 348
"r" => Some(Message::Record), - replacement in crates/flowers_ui/src/main.rs at line 354
Nonematch key {Key::Character(c) => match c.as_str() {"s" if mods == Modifiers::CTRL => Some(Message::Save),_ => None,},Key::Named(_) | Key::Unidentified => None,} - edit in crates/flowers_ui/src/main.rs at line 415
let record_msg_editor = if let Some(record_msg) = state.record_msg.as_ref(){Element::from(text_editor(record_msg).placeholder("Type something here...").on_action(Message::EditRecordMsg),)} else {Element::from(row([]))}; - replacement in crates/flowers_ui/src/main.rs at line 441
Element::from(column([]).width(Length::FillPortion(1))),Element::from(column([record_msg_editor]).width(Length::FillPortion(1)),),