Skip to content

power: Correctly lookup or insert new items into combobox

Benjamin Berg requested to merge benzea/power-combobox-value-setting into master

This should be cherry-picked to stable.

The code to lookup or insert items into the combobox had a few issues. It would assume that the items are sorted, causing existing items to not be found and be inserted instead. It also would simply forget to insert an item if it was larger than all existing items.

This code is now changed to iterate over all items, finding the best insertion point in the process (next item has a larger value, or the values are not increasing anymore). The item will only be inserted if it has not been found.

Fixes #261 (closed)

Merge request reports