auto-scroll to last offset

[?]
Jul 5, 2025, 1:26 PM
K5YUSV2WOLGMA75WKQWY2GRLQGPAFGVYTW3GMVTWEECXF4SXFEYAC

Dependencies

  • [2] IQDCHWCP load a pijul repo
  • [3] 23SFYK4Q big view refactor into a new crate
  • [4] WGID4LS4 absolutely slayed testing with iced task
  • [5] YKHE3XMW refactor diffs handling
  • [6] XHWLKCLD auto-scroll past skip sections on load
  • [7] SASAN2XC use nav-scrollable
  • [8] Z2CJPWZE focus record message text_editor on spawn
  • [9] WT3GA27P add cursor with selection
  • [10] UB2ITZJS refresh changed files on FS changes
  • [11] A5YBC77V record!
  • [12] V55EAIWQ add src file LRU cache
  • [13] WI2BVQ6J rm client lib crate
  • [14] SWWE2R6M display basic repo stuff
  • [15] 4WO3ZJM2 show untracked files' contents
  • [16] NWJD6VM6 mv libflowers libflorescence
  • [17] B4RMW5AE add syntax highlighter to untracked files contents
  • [18] BFN2VHZS refactor file stuff into sub-mod
  • [19] 6YZAVBWU Initial commit
  • [20] FVA36HBV restart repo manager task if it crashes
  • [21] AMPZ2BXK show changed files diffs (only Edit atm)
  • [22] S2NVIFXR allow to enter record msg
  • [*] WW36JYLR add iced_nav_scrollable widget crate

Change contents

  • replacement in inflorescence/src/main.rs at line 14
    [2.1025][3.25428:25459]()
    use iced::widget::text_editor;
    [2.1025]
    [4.5279]
    use iced::widget::{scrollable, text_editor};
  • replacement in inflorescence/src/main.rs at line 287
    [3.26390][5.4022:4246]()
    app::Msg::Cursor(msg) => cursor::update(
    &mut state.cursor,
    &mut state.files,
    state.repo.as_ref(),
    msg,
    )
    .map(|msg| Msg::View(app::Msg::ToRepo(msg))),
    [3.26390]
    [3.26614]
    app::Msg::Cursor(msg) => {
    let cursor_task = cursor::update(
    &mut state.cursor,
    &mut state.files,
    state.repo.as_ref(),
    msg,
    )
    .map(|msg| Msg::View(app::Msg::ToRepo(msg)));
    // If the selected file's diff is already loaded, scroll back to its
    // last offset
    let scroll_task = match state.cursor.selection.as_ref() {
    Some(cursor::Selection::UntrackedFile { ix: _, path }) => {
    let id = file::Id {
    path: path.clone(),
    file_kind: file::Kind::Untracked,
    };
    if let Some(nav) = state
    .files_diffs
    .get(&id)
    .and_then(|state| state.nav.as_ref())
    {
    task::scroll_to(
    nav.id.clone(),
    scrollable::AbsoluteOffset {
    x: 0.0,
    y: nav.offset,
    },
    )
    } else {
    Task::none()
    }
    }
    Some(cursor::Selection::ChangedFile { ix: _, path }) => {
    let id = file::Id {
    path: path.clone(),
    file_kind: file::Kind::Changed,
    };
    if let Some(nav) = state
    .files_diffs
    .get(&id)
    .and_then(|state| state.nav.as_ref())
    {
    task::scroll_to(
    nav.id.clone(),
    scrollable::AbsoluteOffset {
    x: 0.0,
    y: nav.offset,
    },
    )
    } else {
    Task::none()
    }
    }
    Some(cursor::Selection::LogChange {
    ix: _,
    hash,
    message: _,
    file: Some(cursor::LogChangeFileSelection { ix: _, path }),
    }) => {
    let id = repo::LogFileId {
    hash: *hash,
    path: path.clone(),
    };
    if let Some(nav) = state
    .log_diffs
    .get(&id)
    .and_then(|diff| diff.state.nav.as_ref())
    {
    task::scroll_to(
    nav.id.clone(),
    scrollable::AbsoluteOffset {
    x: 0.0,
    y: nav.offset,
    },
    )
    } else {
    Task::none()
    }
    }
    Some(cursor::Selection::LogChange {
    ix: _,
    hash: _,
    message: _,
    file: None,
    })
    | None => Task::none(),
    };
    Task::batch([cursor_task, scroll_task])
    }
  • edit in iced_nav_scrollable/src/lib.rs at line 292
    [6.1017]
    [6.1017]
    debug_assert!(
    !nav.skip_sections.contains(&0) || !nav.skip_sections.contains(&1),
    "Unexpected successive skip sections at ix 0 and 1: {:#?}",
    nav.skip_sections
    );