mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:35:06 +00:00
Shell: Fix wrong step value for brace ranges
This fixes numeric ranges like {1..10}.
This commit is contained in:
parent
5e5eb615ec
commit
66b26fc1c2
1 changed files with 1 additions and 1 deletions
|
@ -1978,7 +1978,7 @@ RefPtr<Value> Range::run(RefPtr<Shell> shell)
|
||||||
if (start_int.has_value() && end_int.has_value()) {
|
if (start_int.has_value() && end_int.has_value()) {
|
||||||
auto start = start_int.value();
|
auto start = start_int.value();
|
||||||
auto end = end_int.value();
|
auto end = end_int.value();
|
||||||
auto step = start > end ? 1 : -1;
|
auto step = start > end ? -1 : 1;
|
||||||
for (int value = start; value != end; value += step)
|
for (int value = start; value != end; value += step)
|
||||||
values.append(create<StringValue>(String::number(value)));
|
values.append(create<StringValue>(String::number(value)));
|
||||||
// Append the range end too, most shells treat this as inclusive.
|
// Append the range end too, most shells treat this as inclusive.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue