unify diffs handling, simplify view
[?]
Jul 5, 2025, 9:07 AM
KEPKF3WO7ZZ2VB2DRVVTWTGPL7TCA52BMYUPHUNUJH6WO3HAT6JQCDependencies
- [2]
V55EAIWQadd src file LRU cache - [3]
JE44NYHMdisplay log files diffs - [4]
23SFYK4Qbig view refactor into a new crate - [5]
OPXFZKEBview tests setup - [6]
3QVNMRNMtest non-empty repo app view - [7]
MYGIBRRHwip custom theme - [8]
PKJCFSBMtheme improvements - [9]
3BK22XE5add a test for hover btn and more refactors - [10]
ACDXXAX2refactor main's updates into smaller fns - [11]
7SSBM4UQview: refactor repo view - [12]
I2AG42PAnew cols layout - [13]
SASAN2XCuse nav-scrollable - [14]
XZ6D3UUEavoid alloc - [15]
YKHE3XMWrefactor diffs handling - [16]
WT3GA27Padd cursor with selection - [17]
OQ6HSAWHshow record log - [18]
YBJRDOTCmake all repo actions async - [19]
BFN2VHZSrefactor file stuff into sub-mod - [20]
XSZZB47Urefactor stuff into lib - [21]
AMPZ2BXKshow changed files diffs (only Edit atm) - [22]
FR52XEMWadd action for log change file diff - [23]
UF5NJKAStest load repo - [24]
S2T7RUKWadd nav back placeholder - [25]
SK3WVX7Aadd wee spacing for nav back - [*]
SWWE2R6Mdisplay basic repo stuff - [*]
6YZAVBWUInitial commit
Change contents
- replacement in libflorescence/src/repo.rs at line 175
pub change_hash: pijul::Hash,/// Hash of the log changepub hash: pijul::Hash, - replacement in inflorescence_view/src/diff.rs at line 28
pub fn view<'a>(state: Option<&'a State>,file: &'a File,) -> Element<'a, Msg, Theme> {pub fn view<'a>(state: &'a State, file: &'a File) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/diff.rs at line 38
state: Option<&'a State>,state: &'a State, - replacement in inflorescence_view/src/diff.rs at line 90
let sections = if let Some(nav) = state.and_then(|state| state.nav.as_ref()){let sections = if let Some(nav) = state.nav.as_ref() { - replacement in inflorescence_view/src/diff.rs at line 115
state: Option<&'a State>,state: &'a State, - replacement in inflorescence_view/src/diff.rs at line 133
if let Some(nav) = state.and_then(|state| state.nav.as_ref()) {if let Some(nav) = state.nav.as_ref() { - replacement in inflorescence_view/src/app.rs at line 30
/// State of selected untracked of changed file, if anypub selected_diff: Option<&'a diff::State>,/// Diff and state of selected log's file, if anypub selected_log_diff: Option<(&'a diff::File, &'a diff::State)>,/// Diff and state of selected log's file (untracked, changed or from a/// log), if anypub selected_diff: Option<(&'a diff::File, &'a diff::State)>, - replacement in inflorescence_view/src/app.rs at line 60
pub fn view<'a, F>(pub fn view<'a>( - replacement in inflorescence_view/src/app.rs at line 63[4.15537]→[4.15537:15559](∅→∅),[4.15559]→[7.7727:7756](∅→∅),[7.7756]→[4.15581:15637](∅→∅),[4.15581]→[4.15581:15637](∅→∅)
get_file_diff: F,) -> Element<'a, Msg, Theme>whereF: Fn(&file::Id) -> Option<&'a file::Diff>,{) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/app.rs at line 65
view_repo(&state, repo, get_file_diff)view_repo(&state, repo) - replacement in inflorescence_view/src/app.rs at line 75
fn view_repo<'a, F>(fn view_repo<'a>( - replacement in inflorescence_view/src/app.rs at line 78
get_file_diff: F,) -> Element<'a, Msg, Theme>whereF: Fn(&file::Id) -> Option<&'a file::Diff>,{) -> Element<'a, Msg, Theme> { - replacement in inflorescence_view/src/app.rs at line 174
let diffs = match get_file_diff(&id) {Some(file::Diff::Loaded(file)) => {diff::view(state.selected_diff, file).map(move |msg| {let diffs = match state.selected_diff {Some((file, state)) => {diff::view(state, file).map(move |msg| { - replacement in inflorescence_view/src/app.rs at line 183
None | Some(file::Diff::Loading) => el(text("Loading diff...")),None => el(text("Loading diff...")), - replacement in inflorescence_view/src/app.rs at line 197
let diffs = match get_file_diff(&id) {Some(file::Diff::Loaded(file)) => {diff::view(state.selected_diff, file).map(move |msg| {let diffs = match state.selected_diff {Some((file, state)) => {diff::view(state, file).map(move |msg| { - replacement in inflorescence_view/src/app.rs at line 206
None | Some(file::Diff::Loading) => el(text("Loading diff...")),None => el(text("Loading diff...")), - replacement in inflorescence_view/src/app.rs at line 298
let col_2 =match state.cursor.selection.as_ref() {Some(cursor::Selection::LogChange {ix: _,hash,message: _,file: Some(cursor::LogChangeFileSelection { ix: _, path }),}) => Some(el(column([el(column([view_diff_header(format!("{path} changes in {}:",display_short_hash(hash))),match state.selected_log_diff {Some((file, state)) => diff::view(Some(state), file).map(|action| Msg::LogChangeFileDiffAction {let col_2 = match state.cursor.selection.as_ref() {Some(cursor::Selection::LogChange {ix: _,hash,message: _,file: Some(cursor::LogChangeFileSelection { ix: _, path }),}) => Some(el(column([el(column([view_diff_header(format!("{path} changes in {}:",display_short_hash(hash))),match state.selected_diff {Some((file, state)) => {diff::view(state, file).map(|action| {Msg::LogChangeFileDiffAction { - replacement in inflorescence_view/src/app.rs at line 317
}),None => el(text("Loading diff..")),},]).width(Length::Fill).height(Length::Fill).spacing(SPACING)),// NOTE: This is currently never true - there are only up to 3// colsif hidden_cols == 2 {el(button(row([el(text("← ").font(Font::MONOSPACE)),el(text("Log")),])).on_press(Msg::Cursor(cursor::Msg::Left)))} else {el(row([]))}})}None => el(text("Loading diff..")), - replacement in inflorescence_view/src/app.rs at line 325
.spacing(SPACING))),.spacing(SPACING)),// NOTE: This is currently never true - there are only up to 3// colsif hidden_cols == 2 {el(button(row([el(text("← ").font(Font::MONOSPACE)),el(text("Log")),])).on_press(Msg::Cursor(cursor::Msg::Left)))} else {el(row([]))},]).width(Length::Fill).height(Length::Fill).spacing(SPACING))), - replacement in inflorescence_view/src/app.rs at line 342
Some(cursor::Selection::UntrackedFile { .. })| Some(cursor::Selection::ChangedFile { .. })| Some(cursor::Selection::LogChange { .. })| None => None,};Some(cursor::Selection::UntrackedFile { .. })| Some(cursor::Selection::ChangedFile { .. })| Some(cursor::Selection::LogChange { .. })| None => None,}; - replacement in inflorescence_view/src/app/test.rs at line 1
use super::{cursor, file, view, State};use super::{cursor, view, State}; - edit in inflorescence_view/src/app/test.rs at line 34
let diff = file::Diff::Loading; - edit in inflorescence_view/src/app/test.rs at line 42
selected_log_diff: None, - replacement in inflorescence_view/src/app/test.rs at line 43
test_view(&mut results,uniq_name,view(state, window_id, |_id| Some(&diff)),size,);test_view(&mut results, uniq_name, view(state, window_id), size); - edit in inflorescence_view/src/app/test.rs at line 63
selected_log_diff: None, - replacement in inflorescence_view/src/app/test.rs at line 64
test_view(&mut results,uniq_name,view(state, window_id, |_id| Some(&diff)),size,);test_view(&mut results, uniq_name, view(state, window_id), size); - edit in inflorescence_view/src/app/test.rs at line 97
selected_log_diff: None, - replacement in inflorescence_view/src/app/test.rs at line 98
test_view(&mut results,uniq_name,view(state, window_id, |_id| Some(&diff)),size,);test_view(&mut results, uniq_name, view(state, window_id), size); - edit in inflorescence_view/src/app/test.rs at line 111
selected_log_diff: None, - replacement in inflorescence_view/src/app/test.rs at line 115
view(state, window_id, |_id| Some(&diff)),view(state, window_id), - edit in inflorescence_view/src/app/test.rs at line 140
selected_log_diff: None, - replacement in inflorescence_view/src/app/test.rs at line 141
test_view(&mut results,uniq_name,view(state, window_id, |_id| Some(&diff)),size,);test_view(&mut results, uniq_name, view(state, window_id), size); - replacement in inflorescence/src/main.rs at line 124
log_diffs: HashMap<LogFileId, LogFileDiff>,log_diffs: HashMap<repo::LogFileId, LogFileDiff>, - edit in inflorescence/src/main.rs at line 150
#[derive(Debug, Clone, PartialEq, Eq, Hash)]struct LogFileId {pub hash: pijul::Hash,pub path: String,} - replacement in inflorescence/src/main.rs at line 211
if let Some(inflorescence_view::cursor::Selection::LogChange {if let Some(cursor::Selection::LogChange { - replacement in inflorescence/src/main.rs at line 219
let id = LogFileId {let id = repo::LogFileId { - replacement in inflorescence/src/main.rs at line 527
let id = LogFileId {let id = repo::LogFileId { - replacement in inflorescence/src/main.rs at line 754
let id = LogFileId { hash, path };let id = repo::LogFileId { hash, path }; - replacement in inflorescence/src/main.rs at line 850
diffs_state.get(&id)let file = files.diffs_cache.inner.peek(&id);match file {Some(file::Diff::Loaded(file)) => {diffs_state.get(&id).map(|state| (file, state))}Some(file::Diff::Loading) | None => None,} - replacement in inflorescence/src/main.rs at line 863
diffs_state.get(&id)let file = files.diffs_cache.inner.peek(&id);match file {Some(file::Diff::Loaded(file)) => {diffs_state.get(&id).map(|state| (file, state))}Some(file::Diff::Loading) | None => None,} - edit in inflorescence/src/main.rs at line 871
Some(cursor::Selection::LogChange { .. }) | None => None,};let selected_log_diff = match state.cursor.selection.as_ref() { - replacement in inflorescence/src/main.rs at line 877
let id = LogFileId {let id = repo::LogFileId { - replacement in inflorescence/src/main.rs at line 883
.map(|LogFileDiff { diff, state }| (diff, state)).map(|LogFileDiff { diff: file, state }| (file, state)) - replacement in inflorescence/src/main.rs at line 885
_ => None,Some(cursor::Selection::LogChange { file: None, .. }) | None => None, - edit in inflorescence/src/main.rs at line 896
selected_log_diff, - edit in inflorescence/src/main.rs at line 898
|id| files.diffs_cache.inner.peek(id),