add log files selection

[?]
May 6, 2025, 6:44 PM
TEI5NQ3SCTU6JQIPU62B2AUXWRFSEU6DZYJG5T526G666VV5XXPAC

Dependencies

  • [2] WT3GA27P add cursor with selection
  • [3] W7IUT3ZV start recording impl
  • [4] YBJRDOTC make all repo actions async
  • [5] D7A7MSIH allow to defer or abandon record, add buttons
  • [6] 4WO3ZJM2 show untracked files' contents
  • [7] FDDPOH5R add arrow controls
  • [8] NRCUG4R2 load changed files src when selected
  • [9] Y5ATDI2H convert changed file diffs and load src only if any needs it
  • [10] ZVI4AWER woot contents_diff
  • [11] QMAUTRB6 refactor diff
  • [12] OQ6HSAWH show record log
  • [13] AHWWRC73 navigate log entries
  • [14] UJPRF6DA fix log changes selection
  • [15] KT5UYXGK fix selection after adding file, add changed file diffs
  • [*] 6YZAVBWU Initial commit

Change contents

  • edit in crates/inflorescence/src/main.rs at line 223
    [2.698]
    [10.2884]
    CursorRight,
    CursorLeft,
  • edit in crates/inflorescence/src/main.rs at line 226
    [10.2918][13.572:682]()
    // TODO 2nd level cursor, should work much the same
    LogEntryFileSelect {
    path: String,
    },
  • edit in crates/inflorescence/src/main.rs at line 301
    [13.945]
    [4.6702]
    let log_file_selection = |log_entry: &repo::LogEntry,
    file_ix: usize,
    log_ix: usize,
    hash: pijul::Hash|
    -> cursor::Selection {
    let path = log_entry.file_paths.iter().nth(file_ix).unwrap().clone();
    cursor::Selection::LogChange {
    ix: log_ix,
    hash,
    file: Some(cursor::LogChangeFileSelection { ix: file_ix, path }),
    }
    };
  • replacement in crates/inflorescence/src/main.rs at line 419
    [13.4452][13.4452:4513]()
    ix,
    hash: _,
    [13.4452]
    [13.4513]
    ix: log_ix,
    hash,
  • replacement in crates/inflorescence/src/main.rs at line 424
    [13.4628][13.4628:4676]()
    Some(_) => todo!(),
    [13.4628]
    [13.4676]
    Some(cursor::LogChangeFileSelection {
    ix: file_ix,
    path: _,
    }) => {
    let log_entry =
    repo.log.iter().nth(*log_ix).unwrap();
    let file_ix = if log_entry
    .file_paths
    .len()
    .saturating_sub(1)
    == *file_ix
    {
    0
    } else {
    file_ix + 1
    };
    log_file_selection(
    log_entry, file_ix, *log_ix, *hash,
    )
    }
  • replacement in crates/inflorescence/src/main.rs at line 447
    [13.4714][13.4714:4791]()
    if repo.log.len().saturating_sub(1) == *ix {
    [13.4714]
    [13.4791]
    if repo.log.len().saturating_sub(1) == *log_ix {
  • replacement in crates/inflorescence/src/main.rs at line 469
    [4.7673][10.7348:7401]()
    let ix = ix + 1;
    [4.7673]
    [13.5240]
    let ix = log_ix + 1;
  • replacement in crates/inflorescence/src/main.rs at line 581
    [12.4752][13.7301:7380]()
    Some(cursor::Selection::LogChange { ix, hash, file }) => {
    [12.4752]
    [13.7380]
    Some(cursor::Selection::LogChange {
    ix: log_ix,
    hash,
    file,
    }) => {
  • replacement in crates/inflorescence/src/main.rs at line 587
    [13.7437][13.7437:7485]()
    Some(_) => todo!(),
    [13.7437]
    [13.7485]
    Some(cursor::LogChangeFileSelection {
    ix: file_ix,
    path: _,
    }) => {
    let log_entry =
    repo.log.iter().nth(*log_ix).unwrap();
    let file_ix = if 0 == *file_ix {
    log_entry.file_paths.len() - 1
    } else {
    file_ix - 1
    };
    log_file_selection(
    log_entry, file_ix, *log_ix, *hash,
    )
    }
  • replacement in crates/inflorescence/src/main.rs at line 605
    [13.7523][13.7523:7569]()
    if 0 == *ix {
    [13.7523]
    [13.7569]
    if 0 == *log_ix {
  • replacement in crates/inflorescence/src/main.rs at line 627
    [13.8823][13.8823:8876]()
    let ix = ix - 1;
    [13.8823]
    [13.8876]
    let ix = log_ix - 1;
  • edit in crates/inflorescence/src/main.rs at line 659
    [4.11210]
    [4.11210]
    }
    Task::none()
    }
    Message::CursorLeft | Message::CursorRight => {
    if let Some(repo) = state.repo.as_ref() {
    // The outter `Option` is for whether the selection should change, the inner is what it should change to if so
    let new_selection: Option<Option<cursor::Selection>> =
    match state.cursor.selection.as_ref() {
    Some(cursor::Selection::LogChange {
    ix,
    hash,
    file,
    }) => Some(Some(if file.is_none() {
    let log_entry = repo.log.iter().nth(*ix).unwrap();
    let file = if let Some(path) =
    log_entry.file_paths.first()
    {
    Some(cursor::LogChangeFileSelection {
    ix: 0,
    path: path.clone(),
    })
    } else {
    None
    };
    cursor::Selection::LogChange {
    ix: *ix,
    hash: *hash,
    file,
    }
    } else {
    cursor::Selection::LogChange {
    ix: *ix,
    hash: *hash,
    file: None,
    }
    })),
    Some(cursor::Selection::UntrackedFile { .. })
    | Some(cursor::Selection::ChangedFile { .. })
    | None => None,
    };
    if let Some(selection) = new_selection {
    state.cursor.selection = selection;
    }
  • replacement in crates/inflorescence/src/main.rs at line 716
    [8.3308][10.9767:9822]()
    cursor::Selection::UntrackedFile {
    [8.3308]
    [10.9822]
    Some(cursor::Selection::UntrackedFile {
  • replacement in crates/inflorescence/src/main.rs at line 720
    [11.513][10.9944:9966](),[10.9944][10.9944:9966]()
    }
    [11.513]
    [8.3308]
    })
  • replacement in crates/inflorescence/src/main.rs at line 739
    [10.10739][10.10739:10792]()
    cursor::Selection::ChangedFile {
    [10.10739]
    [10.10792]
    Some(cursor::Selection::ChangedFile {
  • replacement in crates/inflorescence/src/main.rs at line 743
    [11.569][9.2006:2028](),[10.10914][9.2006:2028](),[9.2006][9.2006:2028]()
    }
    [11.569]
    [6.6157]
    })
  • replacement in crates/inflorescence/src/main.rs at line 746
    [14.484][14.484:535]()
    cursor::Selection::LogChange {
    [14.484]
    [14.535]
    Some(cursor::Selection::LogChange {
  • edit in crates/inflorescence/src/main.rs at line 750
    [14.629]
    [14.629]
    })
    }
    cursor::Select::LogChangeFile { ix, path } => {
    let file = cursor::LogChangeFileSelection { ix, path };
    if let Some(cursor::Selection::LogChange {
    ix,
    hash,
    file: _,
    }) = state.cursor.selection
    {
    Some(cursor::Selection::LogChange {
    ix,
    hash,
    file: Some(file),
    })
    } else {
    None
  • replacement in crates/inflorescence/src/main.rs at line 770
    [6.6249][3.1381:1435](),[10.10930][3.1381:1435](),[2.2594][3.1381:1435]()
    state.cursor.selection = Some(selection);
    [10.10930]
    [3.1435]
    state.cursor.selection = selection;
  • edit in crates/inflorescence/src/main.rs at line 773
    [2.2657][13.9615:9672]()
    Message::LogEntryFileSelect { path } => todo!(),
  • edit in crates/inflorescence/src/main.rs at line 1170
    [2.3009]
    [5.2052]
    "h" => Some(Message::CursorLeft),
    "l" => Some(Message::CursorRight),
  • edit in crates/inflorescence/src/main.rs at line 1178
    [7.240]
    [2.3059]
    Key::Named(key::Named::ArrowLeft) => Some(Message::CursorLeft),
    Key::Named(key::Named::ArrowRight) => {
    Some(Message::CursorRight)
    }
  • replacement in crates/inflorescence/src/main.rs at line 1398
    [13.11924][13.11924:11989]()
    let files = entry.file_paths.iter().map(|path| {
    [13.11924]
    [13.11989]
    let files = entry.file_paths.iter().enumerate().map(|(ix, path)| {
  • replacement in crates/inflorescence/src/main.rs at line 1400
    [13.12134][13.12134:12270]()
    el(button(text(path)).on_press_with(|| {
    Message::LogEntryFileSelect { path: path.clone() }
    [13.12134]
    [13.12270]
    el(button(text(path)).on_press_with(move || {
    Message::CursorSelect(cursor::Select::LogChangeFile { ix, path: path.clone() })
  • edit in crates/inflorescence/src/cursor.rs at line 40
    [14.796]
    [2.188]
    LogChangeFile { ix: usize, path: String },