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

Method old_pos

atomic-cli/src/commands/diff/helpers.rs:47–54  ·  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

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected