mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
Avoid exposing internal tuple in CommitList.marked (#2638)
* Document tuple used in CommitList.marked * Remove CommitList::marked() to avoid exposing internal structure
This commit is contained in:
parent
69fd7e664c
commit
dea3d25bcc
2 changed files with 7 additions and 13 deletions
|
|
@ -45,6 +45,9 @@ pub struct CommitList {
|
||||||
items: ItemBatch,
|
items: ItemBatch,
|
||||||
highlights: Option<Rc<IndexSet<CommitId>>>,
|
highlights: Option<Rc<IndexSet<CommitId>>>,
|
||||||
commits: IndexSet<CommitId>,
|
commits: IndexSet<CommitId>,
|
||||||
|
/// The marked commits.
|
||||||
|
/// `self.marked[].0` holds the commit index into `self.items.items` - used for ordering the list.
|
||||||
|
/// `self.marked[].1` is the commit id of the marked commit.
|
||||||
marked: Vec<(usize, CommitId)>,
|
marked: Vec<(usize, CommitId)>,
|
||||||
scroll_state: (Instant, f32),
|
scroll_state: (Instant, f32),
|
||||||
tags: Option<Tags>,
|
tags: Option<Tags>,
|
||||||
|
|
@ -114,15 +117,6 @@ impl CommitList {
|
||||||
self.marked.len()
|
self.marked.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
#[expect(
|
|
||||||
clippy::missing_const_for_fn,
|
|
||||||
reason = "as of 1.86.0 clippy wants this to be const even though that breaks"
|
|
||||||
)]
|
|
||||||
pub fn marked(&self) -> &[(usize, CommitId)] {
|
|
||||||
&self.marked
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
pub fn clear_marked(&mut self) {
|
pub fn clear_marked(&mut self) {
|
||||||
self.marked.clear();
|
self.marked.clear();
|
||||||
|
|
|
||||||
|
|
@ -586,19 +586,19 @@ impl Component for Revlog {
|
||||||
self.queue.push(InternalEvent::OpenPopup(
|
self.queue.push(InternalEvent::OpenPopup(
|
||||||
StackablePopupOpen::CompareCommits(
|
StackablePopupOpen::CompareCommits(
|
||||||
InspectCommitOpen::new(
|
InspectCommitOpen::new(
|
||||||
self.list.marked()[0].1,
|
self.list.marked_commits()[0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
return Ok(EventState::Consumed);
|
return Ok(EventState::Consumed);
|
||||||
} else if self.list.marked_count() == 2 {
|
} else if self.list.marked_count() == 2 {
|
||||||
//compare two marked commits
|
//compare two marked commits
|
||||||
let marked = self.list.marked();
|
let marked = self.list.marked_commits();
|
||||||
self.queue.push(InternalEvent::OpenPopup(
|
self.queue.push(InternalEvent::OpenPopup(
|
||||||
StackablePopupOpen::CompareCommits(
|
StackablePopupOpen::CompareCommits(
|
||||||
InspectCommitOpen {
|
InspectCommitOpen {
|
||||||
commit_id: marked[0].1,
|
commit_id: marked[0],
|
||||||
compare_id: Some(marked[1].1),
|
compare_id: Some(marked[1]),
|
||||||
tags: None,
|
tags: None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue