NSPopUpButtonCell: keep the correct selection when removing an item#487
Open
DTW-Thalion wants to merge 1 commit into
Open
NSPopUpButtonCell: keep the correct selection when removing an item#487DTW-Thalion wants to merge 1 commit into
DTW-Thalion wants to merge 1 commit into
Conversation
b1582d1 to
cc6426f
Compare
b7108e5 to
b413cac
Compare
removeItemAtIndex: mishandled the selection in two ways. When the selected item was removed the popup was left with no selection; OS X selects the first remaining item. When a different item before the selection was removed, the removal notification re-synced the selection from the menu view's highlighted index (which does not track the removed item), sliding the selection to another item; OS X keeps it on the same item. Select the first item when the selected item is removed, and otherwise re-select the item that was selected.
b413cac to
00305e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-[NSPopUpButtonCell removeItemAtIndex:]mishandled the selection in twoways:
When the selected item was removed, the popup was left with no
selection. OS X selects the first remaining item (and clears the
selection only when the list becomes empty).
When a different item before the selection was removed, the removal
posts a notification that re-syncs the selection from the menu view's
highlighted index — which does not track the removed item — so the
selection slid to a different item. OS X keeps the selection on the same
item (its index just shifts down).
Select the first item when the selected item is removed, and otherwise
re-select the item that was selected. Verified on a macOS runner across
all four cases (remove selected middle/last, remove an earlier item,
remove the only item).
Adds a test for the selection after removing an item.