MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / parse_hunk_start

Method parse_hunk_start

crates/opencode-tui/src/components/diff.rs:137–150  ·  view source on GitHub ↗
(header: &str, is_old: bool)

Source from the content-addressed store, hash-verified

135 }
136
137 fn parse_hunk_start(header: &str, is_old: bool) -> u32 {
138 let parts: Vec<&str> = header.split_whitespace().collect();
139 if parts.len() >= 2 {
140 let range = if is_old { parts[0] } else { parts[1] };
141 range
142 .trim_start_matches(&['-', '+'][..])
143 .split(',')
144 .next()
145 .and_then(|s| s.parse().ok())
146 .unwrap_or(1)
147 } else {
148 1
149 }
150 }
151
152 pub fn set_mode(&mut self, mode: DiffMode) {
153 self.mode = mode;

Callers

nothing calls this directly

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected