mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
Userland: Don't explicitly call Vector<T>::is_null()
This method always returns false so there's no reason for calling it.
This commit is contained in:
parent
24ca645f08
commit
c4d0b0cd6b
2 changed files with 20 additions and 22 deletions
|
@ -99,30 +99,28 @@ SuggestionManager::CompletionAttemptResult SuggestionManager::attempt_completion
|
|||
|
||||
if (m_next_suggestion_index < m_suggestions.size()) {
|
||||
auto can_complete = m_next_suggestion_invariant_offset <= m_largest_common_suggestion_prefix_length;
|
||||
if (!m_last_shown_suggestion.text.is_null()) {
|
||||
ssize_t actual_offset;
|
||||
size_t shown_length = m_last_shown_suggestion_display_length;
|
||||
switch (mode) {
|
||||
case CompletePrefix:
|
||||
ssize_t actual_offset;
|
||||
size_t shown_length = m_last_shown_suggestion_display_length;
|
||||
switch (mode) {
|
||||
case CompletePrefix:
|
||||
actual_offset = 0;
|
||||
break;
|
||||
case ShowSuggestions:
|
||||
actual_offset = 0 - m_largest_common_suggestion_prefix_length + m_next_suggestion_invariant_offset;
|
||||
if (can_complete)
|
||||
shown_length = m_largest_common_suggestion_prefix_length + m_last_shown_suggestion.trivia_view.length();
|
||||
break;
|
||||
default:
|
||||
if (m_last_shown_suggestion_display_length == 0)
|
||||
actual_offset = 0;
|
||||
break;
|
||||
case ShowSuggestions:
|
||||
actual_offset = 0 - m_largest_common_suggestion_prefix_length + m_next_suggestion_invariant_offset;
|
||||
if (can_complete)
|
||||
shown_length = m_largest_common_suggestion_prefix_length + m_last_shown_suggestion.trivia_view.length();
|
||||
break;
|
||||
default:
|
||||
if (m_last_shown_suggestion_display_length == 0)
|
||||
actual_offset = 0;
|
||||
else
|
||||
actual_offset = 0 - m_last_shown_suggestion_display_length + m_next_suggestion_invariant_offset;
|
||||
break;
|
||||
}
|
||||
|
||||
result.offset_region_to_remove = { m_next_suggestion_invariant_offset, shown_length };
|
||||
result.new_cursor_offset = actual_offset;
|
||||
else
|
||||
actual_offset = 0 - m_last_shown_suggestion_display_length + m_next_suggestion_invariant_offset;
|
||||
break;
|
||||
}
|
||||
|
||||
result.offset_region_to_remove = { m_next_suggestion_invariant_offset, shown_length };
|
||||
result.new_cursor_offset = actual_offset;
|
||||
|
||||
auto& suggestion = suggest();
|
||||
set_current_suggestion_initiation_index(initiation_start_index);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue