From 408d7ad6de942cbea523608ef242e9176506abb8 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 30 Jun 2022 15:12:43 +0200 Subject: [PATCH 1/2] fix(gui): missing start/end of list message for last/first element in unfiltered list --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index e6ac6c2b5..52c36ae40 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -500,9 +500,10 @@ const getPreviousElementPath = function ( annotations: AnnotationStore, usages: UsageCountStore, ): { id: string; wrappedAround: boolean } { - let currentIndex = getPreviousIndex(declarations, getIndex(declarations, start)); + const startIndex = getIndex(declarations, start) + let currentIndex = getPreviousIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); - let wrappedAround = false; + let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; while (current !== null && current !== start) { if (filter.shouldKeepDeclaration(current, annotations, usages)) { return { id: current.id, wrappedAround }; @@ -525,9 +526,10 @@ const getNextElementPath = function ( annotations: AnnotationStore, usages: UsageCountStore, ): { id: string; wrappedAround: boolean } { - let currentIndex = getNextIndex(declarations, getIndex(declarations, start)); + const startIndex = getIndex(declarations, start) + let currentIndex = getNextIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); - let wrappedAround = false; + let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex; while (current !== null && current !== start) { if (filter.shouldKeepDeclaration(current, annotations, usages)) { return { id: current.id, wrappedAround }; From 91af256f4bfff7a6fe78e865886f87a0e0ec5069 Mon Sep 17 00:00:00 2001 From: lars-reimann Date: Thu, 30 Jun 2022 13:17:00 +0000 Subject: [PATCH 2/2] style: apply automatic fixes of linters --- api-editor/gui/src/features/menuBar/MenuBar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-editor/gui/src/features/menuBar/MenuBar.tsx b/api-editor/gui/src/features/menuBar/MenuBar.tsx index 52c36ae40..b9688d023 100644 --- a/api-editor/gui/src/features/menuBar/MenuBar.tsx +++ b/api-editor/gui/src/features/menuBar/MenuBar.tsx @@ -500,7 +500,7 @@ const getPreviousElementPath = function ( annotations: AnnotationStore, usages: UsageCountStore, ): { id: string; wrappedAround: boolean } { - const startIndex = getIndex(declarations, start) + const startIndex = getIndex(declarations, start); let currentIndex = getPreviousIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex >= startIndex; @@ -526,7 +526,7 @@ const getNextElementPath = function ( annotations: AnnotationStore, usages: UsageCountStore, ): { id: string; wrappedAround: boolean } { - const startIndex = getIndex(declarations, start) + const startIndex = getIndex(declarations, start); let currentIndex = getNextIndex(declarations, startIndex); let current = getElementAtIndex(declarations, currentIndex); let wrappedAround = startIndex !== null && currentIndex !== null && currentIndex <= startIndex;