summaryrefslogtreecommitdiff
path: root/Libraries/LibLine
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-12-29 16:13:16 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-30 02:13:30 +0100
commit50d24e4f98be524c4ff85c62df7fed442b9fc303 (patch)
tree38ce095ca7b8db85d25f13802cb2cd769f2c3bdd /Libraries/LibLine
parent35c433862551c8db156396332431a70a2b23f13a (diff)
downloadserenity-50d24e4f98be524c4ff85c62df7fed442b9fc303.zip
AK: Make binary_search signature more generic.
Diffstat (limited to 'Libraries/LibLine')
-rw-r--r--Libraries/LibLine/XtermSuggestionDisplay.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Libraries/LibLine/XtermSuggestionDisplay.cpp
index 18eb0483f0..f69e028f3f 100644
--- a/Libraries/LibLine/XtermSuggestionDisplay.cpp
+++ b/Libraries/LibLine/XtermSuggestionDisplay.cpp
@@ -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;