mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibLine: Do a whole bunch of internal error propagation
This commit is contained in:
parent
f9f1e1dd49
commit
40cb41a16c
Notes:
sideshowbarker
2024-07-17 02:08:15 +09:00
Author: https://github.com/timschumi
Commit: 40cb41a16c
Pull-request: https://github.com/SerenityOS/serenity/pull/16994
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/LucasChollet ✅
8 changed files with 212 additions and 187 deletions
|
@ -182,13 +182,13 @@ SuggestionManager::CompletionAttemptResult SuggestionManager::attempt_completion
|
|||
return result;
|
||||
}
|
||||
|
||||
size_t SuggestionManager::for_each_suggestion(Function<IterationDecision(CompletionSuggestion const&, size_t)> callback) const
|
||||
ErrorOr<size_t> SuggestionManager::for_each_suggestion(Function<ErrorOr<IterationDecision>(CompletionSuggestion const&, size_t)> callback) const
|
||||
{
|
||||
size_t start_index { 0 };
|
||||
for (auto& suggestion : m_suggestions) {
|
||||
if (start_index++ < m_last_displayed_suggestion_index)
|
||||
continue;
|
||||
if (callback(suggestion, start_index - 1) == IterationDecision::Break)
|
||||
if (TRY(callback(suggestion, start_index - 1)) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
return start_index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue