RDRBP7AL74NBFNZSQFTU7VQCMWTGJO5RZWGPCWVVS5WRTXJ77DFAC WT3GA27PQ2AOAIGK65O3Q4DMX4AZDVNULBLRL6GF4QW6QCASUEAAC L6KSEFQIWICZJ6HJUFKLZQDEH6X2QMFM4Z7ZZUGMLDMFF7EHRXWAC BFN2VHZS7VCBUHQ4S3CQ3LFQV2V4M6VANNAF32XMRFQVWRGYSZ6AC 3BK22XE5LPOH2EK5AMRXFXHNQNCJ54HEPYRINHJT4DA7INT32I7AC WW36JYLR4AILV7RHQEDJWMX74P74B7G7DRBHH3O2V5TCHRTZJWZQC K5YUSV2WOLGMA75WKQWY2GRLQGPAFGVYTW3GMVTWEECXF4SXFEYAC KWTBNTO3QUUE2YADF6SYW6G6ZOKYEWRJQKIWDGZXR33S3YNDVIZQC 5MUEECMJHU44FL5RDUR3VFBIWK3H4X2L5MVJ73J37PYHZWLUKU2AC 3TLPJ57B2OD5OWJN5WMS7A4W7IGFUWJJHVIXRM34VT6KUN6R4YSAC KQABQCCZCM23QWW43LZD5QBNFOXWLGFNCPPIMNMNFMZSNPSTFVEAC AI3IMKC3HRPMTWQCU5HGWKUHGKTJ22QF7V4AAEI6IEBIZ4WYWCKQC PTWZYQFRWWUOE2WMQT26CKZKFSHAIJVJS3QWHJFYUFDRRTVPHSUAC 6YZAVBWU6E5FYOI5JGEIPXGZLIKAW6LS2AOFIQWEE5DMOPPCD5PQC Msg::Select(select) => {select_exact(select, state, files, repo, files_diffs, log_diffs)}
Msg::Select(select) => select_exact(select,state,files,repo.as_deref(),files_diffs,log_diffs,),
let selection = changed_file_selection(repo, ix, files);(selection, Task::none())} else if !repo.log.is_empty() {
let selection =changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)} else if !repo_state.log.is_empty() {
let selection = untracked_file_selection(repo, ix, files);(selection, Task::none())
let selection =untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
let selection = untracked_file_selection(repo, ix, files);(selection, Task::none())
let selection = untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
(log_selection(repo, ix), Task::none())} else if !repo.untracked_files.is_empty() {
let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(log_selection(repo_state, ix), task)} else if !repo_state.untracked_files.is_empty() {
let selection = untracked_file_selection(repo, ix, files);(selection, Task::none())
let selection =untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
let selection = changed_file_selection(repo, ix, files);(selection, Task::none())
let selection =changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)
let selection = changed_file_selection(repo, ix, files);(selection, Task::none())
let selection = changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)
let selection =if repo.log.len().saturating_sub(1) == log_ix {if !repo.untracked_files.is_empty() {let ix = 0;untracked_file_selection(repo, ix, files)} else if !repo.changed_files.is_empty() {let ix = 0;changed_file_selection(repo, ix, files)} else {let ix = 0;log_selection(repo, ix)}
if repo_state.log.len().saturating_sub(1) == log_ix {// Last log selectedif !repo_state.untracked_files.is_empty() {let ix = 0;let task =iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(untracked_file_selection(repo_state, ix, files),task,)} else if !repo_state.changed_files.is_empty() {let ix = 0;let task =iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(changed_file_selection(repo_state, ix, files),task,)
let ix = log_ix + 1;log_selection(repo, ix)};(selection, Task::none())
let ix = 0;let task =iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(log_selection(repo_state, ix), task)}} else {let ix = log_ix + 1;let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(log_selection(repo_state, ix), task)}
let selection = Some(untracked_file_selection(repo, ix, files));(selection, Task::none())} else if !repo.changed_files.is_empty() {
let selection =Some(untracked_file_selection(repo_state, ix, files));let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)} else if !repo_state.changed_files.is_empty() {
let selection = Some(changed_file_selection(repo, ix, files));(selection, Task::none())} else if !repo.log.is_empty() {let ix = repo.log.len() - 1;let selection = log_selection(repo, ix);(Some(selection), Task::none())
let selection =Some(changed_file_selection(repo_state, ix, files));let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)} else if !repo_state.log.is_empty() {let ix = repo_state.log.len() - 1;let selection = log_selection(repo_state, ix);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state, ix, StatusSectionKind::Log),status_nav,);(Some(selection), task)
if !repo.log.is_empty() {let ix = repo.log.len() - 1;(log_selection(repo, ix), Task::none())} else if !repo.changed_files.is_empty() {let ix = repo.changed_files.len() - 1;let selection = changed_file_selection(repo, ix, files);(selection, Task::none())
// First untracked file selectedif !repo_state.log.is_empty() {let ix = repo_state.log.len() - 1;let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(log_selection(repo_state, ix), task)} else if !repo_state.changed_files.is_empty() {let ix = repo_state.changed_files.len() - 1;let selection =changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)
let ix = repo.untracked_files.len() - 1;let selection = untracked_file_selection(repo, ix, files);(selection, Task::none())
let ix = repo_state.untracked_files.len() - 1;let selection =untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
let selection = untracked_file_selection(repo, ix, files);(selection, Task::none())
let selection = untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
let selection = if !repo.untracked_files.is_empty() {let ix = repo.untracked_files.len() - 1;untracked_file_selection(repo, ix, files)} else if !repo.log.is_empty() {let ix = repo.log.len() - 1;log_selection(repo, ix)
// First changed file selectedif !repo_state.untracked_files.is_empty() {let ix = repo_state.untracked_files.len() - 1;let selection =untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)} else if !repo_state.log.is_empty() {let ix = repo_state.log.len() - 1;let selection = log_selection(repo_state, ix);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(selection, task)
let ix = repo.changed_files.len() - 1;changed_file_selection(repo, ix, files)};(selection, Task::none())
let ix = repo_state.changed_files.len() - 1;let selection =changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)}
let selection = changed_file_selection(repo, ix, files);(selection, Task::none())
let selection = changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)
let selection = if 0 == log_ix {if !repo.changed_files.is_empty() {let ix = repo.changed_files.len() - 1;changed_file_selection(repo, ix, files)} else if !repo.untracked_files.is_empty() {let ix = repo.untracked_files.len() - 1;untracked_file_selection(repo, ix, files)
if 0 == log_ix {// First log selectedif !repo_state.changed_files.is_empty() {let ix = repo_state.changed_files.len() - 1;let selection =changed_file_selection(repo_state, ix, files);let task =iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Changed,),status_nav,);(selection, task)} else if !repo_state.untracked_files.is_empty() {let ix = repo_state.untracked_files.len() - 1;let selection =untracked_file_selection(repo_state, ix, files);let task =iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(selection, task)
let ix = repo.log.len() - 1;log_selection(repo, ix)
let ix = repo_state.log.len() - 1;let selection = log_selection(repo_state, ix);let task =iced_nav_scrollable::scroll_down_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(selection, task)
log_selection(repo, ix)};(selection, Task::none())
let selection = log_selection(repo_state, ix);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Log,),status_nav,);(selection, task)}
let (selection, task) = if !repo.log.is_empty() {let ix = repo.log.len() - 1;let selection = log_selection(repo, ix);(Some(selection), Task::none())} else if !repo.changed_files.is_empty() {let ix = repo.changed_files.len() - 1;let selection = changed_file_selection(repo, ix, files);(Some(selection), Task::none())} else if !repo.untracked_files.is_empty() {let ix = repo.untracked_files.len() - 1;let selection = untracked_file_selection(repo, ix, files);(Some(selection), Task::none())
if !repo_state.log.is_empty() {let ix = repo_state.log.len() - 1;let selection = log_selection(repo_state, ix);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state, ix, StatusSectionKind::Log),status_nav,);(Some(selection), task)} else if !repo_state.changed_files.is_empty() {let ix = repo_state.changed_files.len() - 1;let selection = changed_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(Some(selection), task)} else if !repo_state.untracked_files.is_empty() {let ix = repo_state.untracked_files.len() - 1;let selection = untracked_file_selection(repo_state, ix, files);let task = iced_nav_scrollable::scroll_up_to_section(status_section_ix(repo_state,ix,StatusSectionKind::Untracked,),status_nav,);(Some(selection), task)
fn status_section_ix(repo: &repo::State,ix: usize,kind: StatusSectionKind,) -> usize {// The literals are for section headersmatch kind {StatusSectionKind::Untracked => 1 + ix,StatusSectionKind::Changed => 2 + repo.untracked_files.len() + ix,StatusSectionKind::Log => {3 + repo.untracked_files.len() + repo.changed_files.len() + ix}}}
}pub fn scroll_down_to_section<M>(section_ix: usize,nav: &mut NavScrollable,) -> Task<M> {// If the given section is below the bottom frame, scroll down to align// their bottom edgeslet (offset, height) = nav.section_offsets.iter().zip(nav.section_heights.values()).nth(section_ix).unwrap();if let Some(y) = {// dbg!(ix, offset, height, nav.offset);let bottom_frame =saturating_sub(nav.offset + nav.height, VISIBLE_CONTEXT_HEIGHT);let top_frame = nav.offset + VISIBLE_CONTEXT_HEIGHT;if offset + height > bottom_frame {Some(saturating_sub(offset + height + VISIBLE_CONTEXT_HEIGHT,nav.height,))} else if *offset < top_frame {Some(saturating_sub(*offset, VISIBLE_CONTEXT_HEIGHT))} else {None}} {return task::scroll_to(nav.id.clone(),scrollable::AbsoluteOffset { x: 0.0, y },);}Task::none()
pub fn scroll_up_to_section<M>(section_ix: usize,nav: &mut NavScrollable,) -> Task<M> {// If the given section is above the top frame, scroll up to align their top// edgeslet (offset, height) = nav.section_offsets.iter().zip(nav.section_heights.values()).nth(section_ix).unwrap();if let Some(y) = {// dbg!(ix, offset, height, nav.offset);let bottom_frame =saturating_sub(nav.offset + nav.height, VISIBLE_CONTEXT_HEIGHT);let top_frame = nav.offset + VISIBLE_CONTEXT_HEIGHT;if *offset < top_frame {Some(saturating_sub(*offset, VISIBLE_CONTEXT_HEIGHT))} else if offset + height > bottom_frame {Some(saturating_sub(offset + height + VISIBLE_CONTEXT_HEIGHT,nav.height,))} else {None}} {return task::scroll_to(nav.id.clone(),scrollable::AbsoluteOffset { x: 0.0, y },);}Task::none()}enum Delay {Start,Apply,}