Issue #2097: reject fractional command indices

This commit is contained in:
Alex Chambers
2026-10-17 07:40:34 +02:00
parent f34c7a8a89
commit de44200a8d
3 changed files with 130 additions and 9 deletions
+2 -5
View File
@@ -1103,11 +1103,8 @@ pub fn specs() -> Vec<CommandSpec> {
|s, p| {
let c = "history.restore";
let id = active(s, c)?;
let i = f64_req(p, "index", c)?;
if !(i.is_finite() && i >= 0.0) {
return Err(bad(c, "no such step"));
}
go_to_history_step(s, c, id, i as usize)
let i = index_req(p, "index", c)?;
go_to_history_step(s, c, id, i)
}
),
cmd!("history.previous", "Previous History Step", [], None, "{} — steps the History cursor back one step", has_history_before, |s, _| {