add untracked files encoding

[?]
Mar 29, 2025, 5:26 PM
PTFDJ567XGGF26TE7KVQT7WPZIWV737DBO24VFIPEWPVAVKEKADQC

Dependencies

  • [2] 6YZAVBWU Initial commit
  • [3] KLR5FRIB add fs state read/write of repos
  • [4] IQDCHWCP load a pijul repo
  • [5] 2VUX5BTD load identity
  • [6] A5YBC77V record!
  • [7] D7A7MSIH allow to defer or abandon record, add buttons
  • [8] 4WO3ZJM2 show untracked files' contents
  • [9] BJXUYQ2Y show untracked file contents in read-only text editor
  • [10] WT3GA27P add cursor with selection
  • [11] S2NVIFXR allow to enter record msg
  • [12] YBJRDOTC make all repo actions async

Change contents

  • edit in crates/libflowers/src/prelude.rs at line 3
    [6.4202]
    [3.2378]
    #[doc(inline)]
    pub use data_encoding;
  • edit in crates/libflowers/Cargo.toml at line 15
    [6.4348]
    [6.4348]
    "data-encoding/std",
  • edit in crates/libflowers/Cargo.toml at line 27
    [6.4434]
    [2.2625]
    [dependencies.data-encoding]
    workspace = true
    default-features = false
    features = ["alloc"]
  • replacement in crates/flowers_ui/src/main.rs at line 119
    [8.2567][9.23:67](),[9.67][8.2590:2696](),[8.2590][8.2590:2696]()
    text_content: text_editor::Content,
    // TODO: use pijul pijul::text_changes::Encoding (not exposed yet)
    // encoding: Encoding,
    [8.2567]
    [8.2696]
    content: FileEditorContent,
  • edit in crates/flowers_ui/src/main.rs at line 122
    [8.2705]
    [8.2705]
    const MAX_LEN_BASE64_DISPLAY: usize = 4096;
  • edit in crates/flowers_ui/src/main.rs at line 126
    [8.2723]
    [7.78]
    enum FileEditorContent {
    Decoded(text_editor::Content),
    /// Short byte sequence of unknown encoding encoded with base64 for display.
    /// Must be shorter than [`MAX_LEN_BASE64_DISPLAY`]
    ShortBase64(String),
    UnknownEncoding,
    }
    #[derive(Debug)]
  • replacement in crates/flowers_ui/src/main.rs at line 161
    [7.216][8.2735:2792]()
    LoadedUntrackedFile { path: String, data: Vec<u8> },
    [7.216]
    [9.68]
    LoadedUntrackedFile {
    path: String,
    data: Vec<u8>,
    encoding: Option<pijul::Encoding>,
    },
  • replacement in crates/flowers_ui/src/main.rs at line 542
    [5.1055][8.6522:6579](),[8.6579][9.123:298]()
    Message::LoadedUntrackedFile { path, data } => {
    // TODO: use encoding
    let text_content = text_editor::Content::with_text(
    str::from_utf8(&data).unwrap_or("Not UTF-8"),
    );
    [5.1055]
    [8.6579]
    Message::LoadedUntrackedFile {
    path,
    data,
    encoding,
    } => {
    let content = match encoding {
    Some(encoding) => {
    let decoded = encoding.decode(&data);
    FileEditorContent::Decoded(text_editor::Content::with_text(
    &decoded,
    ))
    }
    None => {
    if data.len() <= MAX_LEN_BASE64_DISPLAY {
    let encoded =
    format!("b{}", data_encoding::BASE64.encode(&data));
    FileEditorContent::ShortBase64(encoded)
    } else {
    FileEditorContent::UnknownEncoding
    }
    }
    };
  • replacement in crates/flowers_ui/src/main.rs at line 570
    [9.402][9.402:448]()
    text_content,
    [9.402]
    [9.448]
    content,
  • replacement in crates/flowers_ui/src/main.rs at line 577
    [8.7059][8.7059:7082]()
    ..
    [8.7059]
    [8.7082]
    content: _,
  • replacement in crates/flowers_ui/src/main.rs at line 583
    [9.584][9.584:630]()
    text_content,
    [9.584]
    [9.630]
    content,
  • replacement in crates/flowers_ui/src/main.rs at line 595
    [9.890][9.890:924]()
    text_content,
    [9.890]
    [9.924]
    content: FileEditorContent::Decoded(content),
  • replacement in crates/flowers_ui/src/main.rs at line 599
    [9.1021][9.1021:1071]()
    text_content.perform(action);
    [9.1021]
    [9.1071]
    content.perform(action);
  • edit in crates/flowers_ui/src/main.rs at line 732
    [8.8337]
    [8.8337]
    let encoding = pijul::change::get_encoding(&data);
  • edit in crates/flowers_ui/src/main.rs at line 736
    [8.8423]
    [8.8423]
    encoding,
  • replacement in crates/flowers_ui/src/main.rs at line 814
    [8.8862][9.1090:1206]()
    text_content,
    }) if loaded_path == path => el(text_editor(text_content)
    [8.8862]
    [9.1206]
    content,
    }) if loaded_path == path => match content {
    FileEditorContent::Decoded(content) => el(text_editor(
    content,
    )
  • edit in crates/flowers_ui/src/main.rs at line 820
    [9.1281]
    [8.9217]
    FileEditorContent::ShortBase64(content) => {
    el(text(content))
    }
    FileEditorContent::UnknownEncoding => {
    el("Unknown encoding")
    }
    },
  • replacement in crates/flowers_ui/src/main.rs at line 849
    [7.3733][7.3733:3771]()
    el(text("Changed:")),
    [7.3733]
    [7.3771]
    el(text("Changes:")),
  • edit in Cargo.toml at line 28
    [6.5661]
    [4.1644]
    [workspace.dependencies.data-encoding]
    version = "2"
    default-features = false
  • replacement in Cargo.lock at line 1118
    [4.6529][4.6529:6547]()
    version = "2.6.0"
    [4.6529]
    [4.6547]
    version = "2.8.0"
  • replacement in Cargo.lock at line 1120
    [4.6612][4.6612:6690]()
    checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
    [4.6612]
    [2.22779]
    checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
  • edit in Cargo.lock at line 2670
    [6.5804]
    [2.44936]
    "data-encoding",