Skip to content

Commit

Permalink
rename BlameHunk.spans → BlameHunk.line
Browse files Browse the repository at this point in the history
  • Loading branch information
raylu committed Nov 3, 2023
1 parent ccf85e7 commit 65f5bd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tui::{

#[derive(Debug)]
pub struct BlameHunk<'a> {
pub spans: Line<'a>,
pub line: Line<'a>,
pub commit: Oid,
pub path: Option<PathBuf>,
}
Expand Down Expand Up @@ -54,7 +54,7 @@ pub fn blame<'a>(
spans.append(&mut format_line_num_and_code(b.line_num, b.code[0]));
let line_path = b.info.path;
out.push(BlameHunk {
spans: Line::from(spans),
line: Line::from(spans),
commit: Oid::from_str(b.commit)?,
path: line_path.map(|p| p.to_owned()),
});
Expand All @@ -64,7 +64,7 @@ pub fn blame<'a>(
let line_num = b.line_num + i32::try_from(i).unwrap();
spans.append(&mut format_line_num_and_code(line_num, b.code[i]));
out.push(BlameHunk {
spans: Line::from(spans),
line: Line::from(spans),
commit: Oid::from_str(b.commit)?,
path: line_path.map(|p| p.to_owned()),
});
Expand Down
4 changes: 2 additions & 2 deletions src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ fn handle_search(blame: &Vec<git::BlameHunk<'_>>, query: &str, blame_state: &mut
Box::new((0..end).rev())
};
for i in range {
let line = &blame[i].spans.spans.last().unwrap().content;
let line = &blame[i].line.spans.last().unwrap().content;
if line.contains(query) {
blame_state.select(Some(i));
return;
Expand Down Expand Up @@ -339,7 +339,7 @@ fn ui(frame: &mut Frame, app: &mut App) {
.constraints(constraints)
.split(size);

let items: Vec<ListItem> = app.blame.iter().map(|line| ListItem::new(line.spans.clone())).collect();
let items: Vec<ListItem> = app.blame.iter().map(|line| ListItem::new(line.line.clone())).collect();
let commit_path = app.commit_stack.last().unwrap();
let title = Line::from(vec![
Span::styled(
Expand Down

0 comments on commit 65f5bd0

Please sign in to comment.