show changed files diffs (only Edit atm)
[?]
Apr 15, 2025, 5:15 PM
AMPZ2BXK4IGUZO3OPBRSJ6Z4GI5K4PRFMLUGTR6AP4FKKRWQG7LQCDependencies
- [2]
6YZAVBWUInitial commit - [3]
IQDCHWCPload a pijul repo - [4]
3GZPRZXCs/-/_ in crate paths - [5]
SWWE2R6Mdisplay basic repo stuff - [6]
WT3GA27Padd cursor with selection - [7]
UB2ITZJSrefresh changed files on FS changes - [8]
KT5UYXGKfix selection after adding file, add changed file diffs - [9]
S2NVIFXRallow to enter record msg - [10]
W7IUT3ZVstart recording impl - [11]
YBJRDOTCmake all repo actions async - [12]
2VUX5BTDload identity - [13]
A5YBC77Vrecord! - [14]
Z2CJPWZEfocus record message text_editor on spawn - [15]
D7A7MSIHallow to defer or abandon record, add buttons - [16]
4WO3ZJM2show untracked files' contents - [17]
BJXUYQ2Yshow untracked file contents in read-only text editor - [18]
CFYW3HGZwip: display changed files - [19]
W4LFX7IHgroup diffs by file name - [20]
PTFDJ567add untracked files encoding - [21]
EC3TVL4Xadd untracked files
Change contents
- replacement in crates/libflowers_client/src/repo.rs at line 19
working_copy, ChannelMutTxnT, ChannelTxnT, Hash, HashSet, MutTxnT,MutTxnTExt, TxnT, TxnTExt,working_copy, ChannelMutTxnT, ChannelTxnT, Encoding, Hash, HashSet,MutTxnT, MutTxnTExt, TxnT, TxnTExt, - edit in crates/libflowers_client/src/repo.rs at line 45
pub const MAX_LEN_BASE64_DISPLAY: usize = 4096; - replacement in crates/libflowers_client/src/repo.rs at line 58
contents: Vec<u8>,contents: Contents, - edit in crates/libflowers_client/src/repo.rs at line 66
}#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]pub enum Contents {Decoded(String),/// Short byte sequence of unknown encoding encoded with base64 for display./// Must be shorter than [`MAX_LEN_BASE64_DISPLAY`]ShortBase64(String),UnknownEncoding(Vec<u8>), - replacement in crates/libflowers_client/src/repo.rs at line 509
encoding: _,encoding, - replacement in crates/libflowers_client/src/repo.rs at line 521
let contents =let raw_contents = - edit in crates/libflowers_client/src/repo.rs at line 524
let contents = try_decode_contents(raw_contents, encoding); - edit in crates/libflowers_client/src/repo.rs at line 639[11.4519]
fn try_decode_contents(raw: Vec<u8>, encoding: &Option<Encoding>) -> Contents {match encoding {Some(encoding) => {let decoded = encoding.decode(&raw);Contents::Decoded(decoded.to_string())}None => {if raw.len() <= MAX_LEN_BASE64_DISPLAY {let encoded =format!("b{}", data_encoding::BASE64.encode(&raw));Contents::ShortBase64(encoded)} else {Contents::UnknownEncoding(raw)}}}} - edit in crates/libflowers_client/src/lib.rs at line 1
pub mod cursor; - edit in crates/flowers_ui/src/main.rs at line 1
mod cursor; - replacement in crates/flowers_ui/src/main.rs at line 5
use libflowers_client::{cursor, identity, repo};use libflowers_client::repo::MAX_LEN_BASE64_DISPLAY;use libflowers_client::{identity, repo}; - replacement in crates/flowers_ui/src/main.rs at line 10[16.1523]→[14.23:43](∅→∅),[3.1025]→[14.23:43](∅→∅),[14.43]→[16.1524:1603](∅→∅),[16.1603]→[14.110:113](∅→∅),[14.110]→[14.110:113](∅→∅)
use iced::widget::{self, button, column, horizontal_rule, row, scrollable, text, text_editor,};use iced::widget::{self, button, column, row, scrollable, text, text_editor}; - edit in crates/flowers_ui/src/main.rs at line 17
use std::collections::BTreeMap; - edit in crates/flowers_ui/src/main.rs at line 25
const SPACING: u16 = 10; - edit in crates/flowers_ui/src/main.rs at line 98
changed_files_contents: BTreeMap::default(), - edit in crates/flowers_ui/src/main.rs at line 115
/// Keyed by file name matching `repo::ChangedFiles`changed_files_contents: ChangedFilesContents, - edit in crates/flowers_ui/src/main.rs at line 130
const MAX_LEN_BASE64_DISPLAY: usize = 4096; - edit in crates/flowers_ui/src/main.rs at line 138
type ChangedFilesContents = BTreeMap<String, ChangedFileContents>; - edit in crates/flowers_ui/src/main.rs at line 141
/// The order of the vec matches `repo::ChangedFile`type ChangedFileContents = Vec<Option<FileEditorContent>>; - edit in crates/flowers_ui/src/main.rs at line 177
ChangedFileContentsAction {file: String,ix: usize,action: text_editor::Action,}, - edit in crates/flowers_ui/src/main.rs at line 528
state.changed_files_contents = BTreeMap::default(); - edit in crates/flowers_ui/src/main.rs at line 616
}}Task::none()}Message::ChangedFileContentsAction { file, ix, action } => {// Read-onlyif !action.is_edit() {if let Some(contents) =state.changed_files_contents.get_mut(&file){if let Some(content) = contents.get_mut(ix) {match content {Some(FileEditorContent::Decoded(content)) => {content.perform(action);}_ => panic!("Unexpected content: {content:?}"),}} - edit in crates/flowers_ui/src/main.rs at line 644
state.changed_files_contents =changed_files_contents(&repo.changed_files); - edit in crates/flowers_ui/src/main.rs at line 685
state.changed_files_contents =changed_files_contents(&changed_files); - edit in crates/flowers_ui/src/main.rs at line 728
}}}fn changed_files_contents(changed_files: &repo::ChangedFiles,) -> ChangedFilesContents {changed_files.iter().map(|(file, diffs)| {let contents = diffs.iter().map(|diff| match diff {repo::ChangedFileDiff::Move => None,repo::ChangedFileDiff::Del => None,repo::ChangedFileDiff::Undel => None,repo::ChangedFileDiff::Add => None,repo::ChangedFileDiff::SolveNameConflict => None,repo::ChangedFileDiff::UnsolveNameConflict => None,repo::ChangedFileDiff::Edit {line: _,deleted: _,contents,} => Some(contents_to_file_editor_content(contents)),repo::ChangedFileDiff::Replacement => None,repo::ChangedFileDiff::SolveOrderConflict => None,repo::ChangedFileDiff::UnsolveOrderConflict => None,repo::ChangedFileDiff::ResurrectZombines => None,repo::ChangedFileDiff::AddRoot => None,repo::ChangedFileDiff::DelRoot => None,}).collect();(file.clone(), contents)}).collect()}fn contents_to_file_editor_content(contents: &repo::Contents,) -> FileEditorContent {match contents {repo::Contents::Decoded(content) => {FileEditorContent::Decoded(text_editor::Content::with_text(content)) - edit in crates/flowers_ui/src/main.rs at line 772
repo::Contents::ShortBase64(short) => {FileEditorContent::ShortBase64(short.clone())}repo::Contents::UnknownEncoding(_vec) => {FileEditorContent::UnknownEncoding} - replacement in crates/flowers_ui/src/main.rs at line 919
let changed_file = repo.changed_files.iter().nth(*ix).unwrap();let diff = "todo";let (file_name, diffs) =repo.changed_files.iter().nth(*ix).unwrap();let file_editor_contents =state.changed_files_contents.get(file_name).unwrap();let diffs = diffs.iter().enumerate().map(|(ix, diff)| {let file_editor_content =file_editor_contents.get(ix).unwrap();view_diff(diff, file_editor_content, file_name, ix)}); - replacement in crates/flowers_ui/src/main.rs at line 930
el(scrollable(text(diff))),el(scrollable(column(diffs).spacing(SPACING))), - replacement in crates/flowers_ui/src/main.rs at line 939[15.3580]→[15.3580:3733](∅→∅),[15.3733]→[20.2327:2365](∅→∅),[20.2365]→[15.3771:3842](∅→∅),[15.3771]→[15.3771:3842](∅→∅)
el(horizontal_rule(1)),el(text("Untracked:")),untracked_files,el(horizontal_rule(1)),el(text("Changes:")),changed_files,el(horizontal_rule(1)),el(column([el(text("Untracked files:")), untracked_files])),el(column([el(text("Changed files:")), changed_files])), - replacement in crates/flowers_ui/src/main.rs at line 943
.width(Length::FillPortion(1))),.width(Length::FillPortion(1)).spacing(SPACING)), - replacement in crates/flowers_ui/src/main.rs at line 947
]))]).spacing(SPACING)) - edit in crates/flowers_ui/src/main.rs at line 954
fn view_diff<'a>(diff: &'a repo::ChangedFileDiff,content: &'a Option<FileEditorContent>,file: &'a String,ix: usize,) -> Element<'a, Message> {match content {Some(content) => match content {FileEditorContent::Decoded(content) => el(text_editor(content).on_action(move |action| Message::ChangedFileContentsAction {file: file.clone(),ix,action,})),FileEditorContent::ShortBase64(short) => el(text(short)),FileEditorContent::UnknownEncoding => el(text(format!("{diff:?}"))),},None => el(text(format!("{diff:?}"))),}} - file move: cursor.rs → cursor.rs