From 95f88ce8028490ea21816f03f84c707fdc978c64 Mon Sep 17 00:00:00 2001 From: zonble Date: Wed, 19 Jan 2022 13:20:27 +0800 Subject: [PATCH] Fixes an underlying issue in the tableViewSelectionDidChange method. --- .../Sources/CandidateUI/VerticalCandidateController.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Packages/CandidateUI/Sources/CandidateUI/VerticalCandidateController.swift b/Packages/CandidateUI/Sources/CandidateUI/VerticalCandidateController.swift index 5be7cf02..dbbbd55d 100644 --- a/Packages/CandidateUI/Sources/CandidateUI/VerticalCandidateController.swift +++ b/Packages/CandidateUI/Sources/CandidateUI/VerticalCandidateController.swift @@ -310,10 +310,12 @@ extension VerticalCandidateController: NSTableViewDataSource, NSTableViewDelegat // keep track of the highlighted index in the key label strip let firstVisibleRow = tableView.row(at: scrollView.documentVisibleRect.origin) // firstVisibleRow cannot be larger than selectedRow. - if firstVisibleRow > selectedRow { - return + if selectedRow >= firstVisibleRow { + keyLabelStripView.highlightedIndex = UInt(selectedRow - firstVisibleRow) + } else { + keyLabelStripView.highlightedIndex = UInt.max } - keyLabelStripView.highlightedIndex = UInt(selectedRow - firstVisibleRow) + keyLabelStripView.setNeedsDisplay(keyLabelStripView.frame) // fix a subtle OS X "bug" that, since we force the scroller to appear,