show untracked file contents in read-only text editor

[?]
Mar 27, 2025, 9:29 AM
BJXUYQ2YQMVULJITT5FEA6NERJVLWFKEAWSBYZVIB7KAT27KOWBAC

Dependencies

Change contents

  • replacement in crates/flowers_ui/src/main.rs at line 120
    [3.2567][3.2567:2590]()
    data: Vec<u8>,
    [3.2567]
    [3.2590]
    text_content: text_editor::Content,
  • edit in crates/flowers_ui/src/main.rs at line 154
    [3.2792]
    [2.735]
    UntrackedFileContentsAction(text_editor::Action),
  • edit in crates/flowers_ui/src/main.rs at line 527
    [3.6579]
    [3.6579]
    // TODO: use encoding
    let text_content = text_editor::Content::with_text(
    str::from_utf8(&data).unwrap_or("Not UTF-8"),
    );
  • replacement in crates/flowers_ui/src/main.rs at line 535
    [3.6814][3.6814:6894]()
    Some(UntrackedFileContents::Loaded { path, data });
    [3.6814]
    [3.6894]
    Some(UntrackedFileContents::Loaded {
    path,
    text_content,
    });
  • replacement in crates/flowers_ui/src/main.rs at line 548
    [3.7208][3.7208:7288]()
    Some(UntrackedFileContents::Loaded { path, data });
    [3.7208]
    [3.7288]
    Some(UntrackedFileContents::Loaded {
    path,
    text_content,
    });
  • edit in crates/flowers_ui/src/main.rs at line 555
    [3.7355]
    [3.7355]
    }
    Task::none()
    }
    Message::UntrackedFileContentsAction(action) => {
    // Read-only
    if !action.is_edit() {
    if let Some(UntrackedFileContents::Loaded {
    text_content,
    ..
    }) = &mut state.untracked_file_contents
    {
    text_content.perform(action);
    }
  • replacement in crates/flowers_ui/src/main.rs at line 780
    [3.8862][3.8862:9217]()
    data,
    }) if loaded_path == path =>
    // TODO: use encoding
    {
    el(scrollable(text(
    str::from_utf8(data).unwrap_or("Not UTF-8"),
    ))
    .width(Length::Fill))
    }
    [3.8862]
    [3.9217]
    text_content,
    }) if loaded_path == path => el(text_editor(text_content)
    .on_action(Message::UntrackedFileContentsAction)),
  • replacement in crates/flowers_ui/src/main.rs at line 785
    [3.9285][3.9285:9339]()
    el(column([el(text("Diff:")), diff]))
    [3.9285]
    [3.9339]
    el(column([el(text(format!("{path} diff:"))), diff]))