1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 14:35:07 +00:00

AK: Make binary_search signature more generic.

This commit is contained in:
asynts 2020-12-29 16:13:16 +01:00 committed by Andreas Kling
parent 35c4338625
commit 50d24e4f98
6 changed files with 63 additions and 53 deletions

View file

@ -187,12 +187,14 @@ size_t XtermSuggestionDisplay::fit_to_page_boundary(size_t selection_index)
size_t index = 0;
auto* match = binary_search(
m_pages.span(), { selection_index, selection_index }, [](auto& a, auto& b) -> int {
m_pages.span(),
PageRange { selection_index, selection_index },
&index,
[](auto& a, auto& b) -> int {
if (a.start >= b.start && a.start < b.end)
return 0;
return a.start - b.start;
},
&index);
});
if (!match)
return m_pages.size() - 1;