summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp2
-rw-r--r--Userland/Libraries/LibLine/SuggestionManager.cpp40
2 files changed, 20 insertions, 22 deletions
diff --git a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
index 834660c25e..c700611e3b 100644
--- a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
+++ b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
@@ -23,7 +23,7 @@ void BarsVisualizationWidget::paint_event(GUI::PaintEvent& event)
painter.add_clip_rect(event.rect());
painter.fill_rect(frame_inner_rect(), Color::Black);
- if (m_sample_buffer.is_null() || m_sample_buffer.is_empty())
+ if (m_sample_buffer.is_empty())
return;
fft(m_sample_buffer, false);
diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp
index 0eb384abfa..6f0d5a5b57 100644
--- a/Userland/Libraries/LibLine/SuggestionManager.cpp
+++ b/Userland/Libraries/LibLine/SuggestionManager.cpp
@@ -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);