MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / old_pos

Method old_pos

atomic-cli/src/commands/diff/helpers.rs:51–58  ·  view source on GitHub ↗

Old-file position: the line number for removals, or the insertion boundary (the number of the preceding old line) for additions.

(&self)

Source from the content-addressed store, hash-verified

49 /// Old-file position: the line number for removals, or the insertion
50 /// boundary (the number of the preceding old line) for additions.
51 fn old_pos(&self) -> usize {
52 match self.line.status {
53 LineStatus::Removed => self.line.old_line_num.unwrap_or(1),
54 _ => {
55 (self.line.new_line_num.unwrap_or(1) as isize - 1 - self.net_before).max(0) as usize
56 }
57 }
58 }
59
60 /// New-file position: the line number for additions, or the deletion
61 /// boundary (the number of the preceding new line) for removals.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected