git-stack-cli 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/MultiSelect.js +7 -6
- package/package.json +1 -1
package/dist/app/MultiSelect.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import * as Ink from "ink";
|
|
3
3
|
import { clamp } from "../core/clamp.js";
|
|
4
4
|
import { colors } from "../core/colors.js";
|
|
5
|
+
import { is_finite_value } from "../core/is_finite_value.js";
|
|
5
6
|
import { wrap_index } from "../core/wrap_index.js";
|
|
6
7
|
export function MultiSelect(props) {
|
|
7
8
|
const [selected_set, select] = React.useReducer((state, value) => {
|
|
@@ -25,18 +26,18 @@ export function MultiSelect(props) {
|
|
|
25
26
|
const [index, set_index] = React.useReducer((_, value) => {
|
|
26
27
|
return clamp(value, 0, props.items.length - 1);
|
|
27
28
|
}, 0, function find_initial_index() {
|
|
28
|
-
let
|
|
29
|
+
let last_enabled;
|
|
29
30
|
for (let i = props.items.length - 1; i >= 0; i--) {
|
|
30
31
|
const item = props.items[i];
|
|
31
|
-
if (!item.disabled
|
|
32
|
-
|
|
32
|
+
if (!item.disabled) {
|
|
33
|
+
last_enabled = i;
|
|
33
34
|
}
|
|
34
|
-
if (item.selected && !item.disabled) {
|
|
35
|
+
if (!item.selected && !item.disabled) {
|
|
35
36
|
return i;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
39
|
+
if (is_finite_value(last_enabled)) {
|
|
40
|
+
return last_enabled;
|
|
40
41
|
}
|
|
41
42
|
return 0;
|
|
42
43
|
});
|