Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 0cb9731

Browse files
authored
fix(gui): missing start/end of list message for last/first element in unfiltered list (#823)
* fix(gui): missing start/end of list message for last/first element in unfiltered list * style: apply automatic fixes of linters Co-authored-by: lars-reimann <[email protected]>
1 parent cddf23f commit 0cb9731

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

api-editor/gui/src/features/menuBar/MenuBar.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,10 @@ const getPreviousElementPath = function (
500500
annotations: AnnotationStore,
501501
usages: UsageCountStore,
502502
): { id: string; wrappedAround: boolean } {
503-
let currentIndex = getPreviousIndex(declarations, getIndex(declarations, start));
503+
const startIndex = getIndex(declarations, start);
504+
let currentIndex = getPreviousIndex(declarations, startIndex);
504505
let current = getElementAtIndex(declarations, currentIndex);
505-
let wrappedAround = false;
506+
let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex;
506507
while (current !== null && current !== start) {
507508
if (filter.shouldKeepDeclaration(current, annotations, usages)) {
508509
return { id: current.id, wrappedAround };
@@ -525,9 +526,10 @@ const getNextElementPath = function (
525526
annotations: AnnotationStore,
526527
usages: UsageCountStore,
527528
): { id: string; wrappedAround: boolean } {
528-
let currentIndex = getNextIndex(declarations, getIndex(declarations, start));
529+
const startIndex = getIndex(declarations, start);
530+
let currentIndex = getNextIndex(declarations, startIndex);
529531
let current = getElementAtIndex(declarations, currentIndex);
530-
let wrappedAround = false;
532+
let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex;
531533
while (current !== null && current !== start) {
532534
if (filter.shouldKeepDeclaration(current, annotations, usages)) {
533535
return { id: current.id, wrappedAround };

0 commit comments

Comments
 (0)