Jelajahi Sumber

LibGUI: Hide TextEditor dbgln spew under TEXTEDITOR_DEBUG

Brian Gianforcaro 4 tahun lalu
induk
melakukan
06df26da67
1 mengubah file dengan 7 tambahan dan 7 penghapusan
  1. 7 7
      Userland/Libraries/LibGUI/TextEditor.cpp

+ 7 - 7
Userland/Libraries/LibGUI/TextEditor.cpp

@@ -519,7 +519,7 @@ void TextEditor::paint_event(PaintEvent& event)
                         continue;
                         continue;
                     }
                     }
                     if (span.range.end().line() < line_index) {
                     if (span.range.end().line() < line_index) {
-                        dbgln("spans not sorted (span end {}:{} is before current line {}) => ignoring", span.range.end().line(), span.range.end().column(), line_index);
+                        dbgln_if(TEXTEDITOR_DEBUG, "spans not sorted (span end {}:{} is before current line {}) => ignoring", span.range.end().line(), span.range.end().column(), line_index);
                         ++span_index;
                         ++span_index;
                         continue;
                         continue;
                     }
                     }
@@ -532,13 +532,13 @@ void TextEditor::paint_event(PaintEvent& event)
                         if (span.range.end().column() == span.range.start().column() - 1) {
                         if (span.range.end().column() == span.range.start().column() - 1) {
                             // span length is zero, just ignore
                             // span length is zero, just ignore
                         } else {
                         } else {
-                            dbgln("span form {}:{} to {}:{} has negative length => ignoring", span.range.start().line(), span.range.start().column(), span.range.end().line(), span.range.end().column());
+                            dbgln_if(TEXTEDITOR_DEBUG, "span form {}:{} to {}:{} has negative length => ignoring", span.range.start().line(), span.range.start().column(), span.range.end().line(), span.range.end().column());
                         }
                         }
                         ++span_index;
                         ++span_index;
                         continue;
                         continue;
                     }
                     }
                     if (span.range.end().line() == line_index && span.range.end().column() < start_of_visual_line + next_column) {
                     if (span.range.end().line() == line_index && span.range.end().column() < start_of_visual_line + next_column) {
-                        dbgln("spans not sorted (span end {}:{} is before current position {}:{}) => ignoring",
+                        dbgln_if(TEXTEDITOR_DEBUG, "spans not sorted (span end {}:{} is before current position {}:{}) => ignoring",
                             span.range.end().line(), span.range.end().column(), line_index, start_of_visual_line + next_column);
                             span.range.end().line(), span.range.end().column(), line_index, start_of_visual_line + next_column);
                         ++span_index;
                         ++span_index;
                         continue;
                         continue;
@@ -550,7 +550,7 @@ void TextEditor::paint_event(PaintEvent& event)
                         span_start = span.range.start().column() - start_of_visual_line;
                         span_start = span.range.start().column() - start_of_visual_line;
                     }
                     }
                     if (span_start < next_column) {
                     if (span_start < next_column) {
-                        dbgln("span started before the current position, maybe two spans overlap? (span start {} is before current position {}) => ignoring", span_start, next_column);
+                        dbgln_if(TEXTEDITOR_DEBUG, "span started before the current position, maybe two spans overlap? (span start {} is before current position {}) => ignoring", span_start, next_column);
                         ++span_index;
                         ++span_index;
                         continue;
                         continue;
                     }
                     }
@@ -1297,7 +1297,7 @@ void TextEditor::cut()
     if (!is_editable())
     if (!is_editable())
         return;
         return;
     auto selected_text = this->selected_text();
     auto selected_text = this->selected_text();
-    dbgln("Cut: \"{}\"", selected_text);
+    dbgln_if(TEXTEDITOR_DEBUG, "Cut: \"{}\"", selected_text);
     Clipboard::the().set_plain_text(selected_text);
     Clipboard::the().set_plain_text(selected_text);
     delete_selection();
     delete_selection();
 }
 }
@@ -1305,7 +1305,7 @@ void TextEditor::cut()
 void TextEditor::copy()
 void TextEditor::copy()
 {
 {
     auto selected_text = this->selected_text();
     auto selected_text = this->selected_text();
-    dbgln("Copy: \"{}\"\n", selected_text);
+    dbgln_if(TEXTEDITOR_DEBUG, "Copy: \"{}\"\n", selected_text);
     Clipboard::the().set_plain_text(selected_text);
     Clipboard::the().set_plain_text(selected_text);
 }
 }
 
 
@@ -1319,7 +1319,7 @@ void TextEditor::paste()
     if (paste_text.is_empty())
     if (paste_text.is_empty())
         return;
         return;
 
 
-    dbgln("Paste: \"{}\"", String::copy(paste_text));
+    dbgln_if(TEXTEDITOR_DEBUG, "Paste: \"{}\"", String::copy(paste_text));
 
 
     TemporaryChange change(m_automatic_indentation_enabled, false);
     TemporaryChange change(m_automatic_indentation_enabled, false);
     insert_at_cursor_or_replace_selection(paste_text);
     insert_at_cursor_or_replace_selection(paste_text);