allow to enter record msg

[?]
Feb 15, 2025, 7:22 PM
S2NVIFXRFER4SRA37WCT5XTXHDHAL5WIGGKY4A4XOTPLTKTZSRGQC

Dependencies

  • [2] IQDCHWCP load a pijul repo
  • [3] SWWE2R6M display basic repo stuff
  • [4] WT3GA27P add cursor with selection
  • [5] UB2ITZJS refresh changed files on FS changes
  • [6] ELG3UDT6 allow to rm added files
  • [7] KT5UYXGK fix selection after adding file, add changed file diffs
  • [8] EC3TVL4X add untracked files
  • [9] 6YZAVBWU Initial commit

Change contents

  • replacement in crates/flowers_ui/src/main.rs at line 5
    [2.1025][4.373:437]()
    use iced::widget::{button, column, horizontal_rule, row, text};
    [2.1025]
    [4.437]
    use iced::widget::{button, column, horizontal_rule, row, text, text_editor};
  • edit in crates/flowers_ui/src/main.rs at line 62
    [5.1520]
    [5.1520]
    record_msg: None,
  • edit in crates/flowers_ui/src/main.rs at line 73
    [4.652]
    [2.1403]
    record_msg: Option<text_editor::Content>,
  • edit in crates/flowers_ui/src/main.rs at line 88
    [6.649]
    [4.735]
    Record,
    EditRecordMsg(text_editor::Action),
    Save,
  • edit in crates/flowers_ui/src/main.rs at line 304
    [6.2027]
    [6.2027]
    }
    }
    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
    [6.2051]
    [4.2657]
    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
    [4.2717][4.2717:2762]()
    use iced::keyboard::{on_key_press, Key};
    [4.2717]
    [4.2762]
    use iced::keyboard::{on_key_press, Key, Modifiers};
  • edit in crates/flowers_ui/src/main.rs at line 348
    [6.2107]
    [4.3009]
    "r" => Some(Message::Record),
  • replacement in crates/flowers_ui/src/main.rs at line 354
    [4.3149][4.3149:3166]()
    None
    [4.3149]
    [4.3166]
    match 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
    [4.4171]
    [3.5731]
    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
    [3.6050][3.6050:6115]()
    Element::from(column([]).width(Length::FillPortion(1))),
    [3.6050]
    [3.6115]
    Element::from(
    column([record_msg_editor]).width(Length::FillPortion(1)),
    ),