summaryrefslogtreecommitdiff
path: root/Libraries/LibLine/Editor.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-21 20:07:09 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-21 22:50:14 +0200
commitfbcfc8dcd06d9f19c3aff9b62d18f6544b00b47c (patch)
tree314cf6772389b5a27f585dd67bee319cec49c7d8 /Libraries/LibLine/Editor.cpp
parent9241c3a957c0d04fb3ded503b2509c7242847ca4 (diff)
downloadserenity-fbcfc8dcd06d9f19c3aff9b62d18f6544b00b47c.zip
LibLine: Hide debug output behind SUGGESTIONS_DEBUG define
Diffstat (limited to 'Libraries/LibLine/Editor.cpp')
-rw-r--r--Libraries/LibLine/Editor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp
index 71eeb1efbc..bba52d9d1f 100644
--- a/Libraries/LibLine/Editor.cpp
+++ b/Libraries/LibLine/Editor.cpp
@@ -35,6 +35,8 @@
#include <sys/time.h>
#include <unistd.h>
+// #define SUGGESTIONS_DEBUG
+
namespace Line {
Editor::Editor(Configuration configuration)
@@ -524,7 +526,9 @@ String Editor::get_line(const String& prompt)
}
m_last_shown_suggestion = m_suggestions[m_next_suggestion_index];
m_last_shown_suggestion.token_start_index = token_start - m_next_suggestion_invariant_offset - m_next_suggestion_static_offset;
+#ifdef SUGGESTIONS_DEBUG
dbg() << "Last shown suggestion token start index: " << m_last_shown_suggestion.token_start_index << " Token Start " << token_start << " invariant offset " << m_next_suggestion_invariant_offset;
+#endif
m_last_shown_suggestion_display_length = m_last_shown_suggestion.text.length();
m_last_shown_suggestion_was_complete = true;
if (m_times_tab_pressed == 1) {
@@ -661,7 +665,9 @@ String Editor::get_line(const String& prompt)
if (m_times_tab_pressed) {
// Apply the style of the last suggestion
+#ifdef SUGGESTIONS_DEBUG
dbg() << "Last shown suggestion token start index: " << m_last_shown_suggestion.token_start_index << " invariant offset " << m_next_suggestion_invariant_offset << " static offset " << m_next_suggestion_static_offset;
+#endif
readjust_anchored_styles(m_last_shown_suggestion.token_start_index, ModificationKind::ForcedOverlapRemoval);
stylize({ m_last_shown_suggestion.token_start_index, m_cursor, Span::Mode::CodepointOriented }, m_last_shown_suggestion.style);
// we probably have some suggestions drawn