mirror of
https://github.com/nushell/nushell.git
synced 2024-11-30 04:14:17 +01:00
Fix drop nth with open end range on 32-bit platforms (#5808)
Fixes #5793 Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
8c0d60d0fb
commit
8b368b6a4e
@ -137,9 +137,16 @@ impl Command for DropNth {
|
|||||||
|
|
||||||
// check for equality to isize::MAX because for some reason,
|
// check for equality to isize::MAX because for some reason,
|
||||||
// the parser returns isize::MAX when we provide a range without upper bound (e.g., 5.. )
|
// the parser returns isize::MAX when we provide a range without upper bound (e.g., 5.. )
|
||||||
let to = to as usize;
|
let mut to = to as usize;
|
||||||
let from = from as usize;
|
let from = from as usize;
|
||||||
|
|
||||||
|
if let PipelineData::Value(Value::List { ref vals, span: _ }, _) = input {
|
||||||
|
let max = from + vals.len() - 1;
|
||||||
|
if to > max {
|
||||||
|
to = max;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if to > 0 && to as isize == isize::MAX {
|
if to > 0 && to as isize == isize::MAX {
|
||||||
lower_bound = Some(from);
|
lower_bound = Some(from);
|
||||||
vec![from]
|
vec![from]
|
||||||
|
Loading…
Reference in New Issue
Block a user