diff --git a/termwiz/src/escape/osc.rs b/termwiz/src/escape/osc.rs index 1313f9d2d..816ec07f2 100644 --- a/termwiz/src/escape/osc.rs +++ b/termwiz/src/escape/osc.rs @@ -261,7 +261,8 @@ impl OperatingSystemCommand { // So, for non-numeric OSCs, we look up the prefix and use that. // This only works if the non-numeric OSC code has length == 1. let osc_code = if !p1str.chars().nth(0).unwrap().is_ascii_digit() && osc.len() == 1 { - OperatingSystemCommandCode::from_code(&p1str[0..1]) + let p1rest: String = p1str.chars().skip(1).collect(); + OperatingSystemCommandCode::from_code(&p1rest) } else { OperatingSystemCommandCode::from_code(&p1str) } diff --git a/vtparse/src/lib.rs b/vtparse/src/lib.rs index 14b8e8a57..e0ac83ca0 100644 --- a/vtparse/src/lib.rs +++ b/vtparse/src/lib.rs @@ -307,7 +307,7 @@ impl OscState { self.full = true; } num => { - self.param_indices[num - 1] = self.buffer.len(); + self.param_indices[num.saturating_sub(1)] = self.buffer.len(); self.num_params += 1; } }