Przeglądaj źródła

LibGUI: Rename function to make intention clearer

SimonFJ20 3 lat temu
rodzic
commit
791e881892

+ 1 - 1
Userland/DevTools/Playground/main.cpp

@@ -227,7 +227,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     TRY(edit_menu->try_add_action(GUI::Action::create("&Format GML", { Mod_Ctrl | Mod_Shift, Key_I }, [&](auto&) {
         auto formatted_gml_or_error = GUI::GML::format_gml(editor->text());
         if (!formatted_gml_or_error.is_error()) {
-            editor->replace_all_text_while_keeping_undo_stack(formatted_gml_or_error.release_value());
+            editor->replace_all_text_without_resetting_undo_stack(formatted_gml_or_error.release_value());
         } else {
             GUI::MessageBox::show(
                 window,

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

@@ -1446,14 +1446,14 @@ void TextEditor::insert_at_cursor_or_replace_selection(StringView text)
     }
 }
 
-void TextEditor::replace_all_text_while_keeping_undo_stack(StringView text)
+void TextEditor::replace_all_text_without_resetting_undo_stack(StringView text)
 {
     auto start = GUI::TextPosition(0, 0);
     auto last_line_index = line_count() - 1;
     auto end = GUI::TextPosition(last_line_index, line(last_line_index).length());
     auto range = GUI::TextRange(start, end);
     auto normalized_range = range.normalized();
-    execute<ReplaceAllTextCommand>(text, range);
+    execute<ReplaceAllTextCommand>(text, range, "GML Playground Format Text");
     did_change();
     set_cursor(normalized_range.start());
     update();

+ 1 - 1
Userland/Libraries/LibGUI/TextEditor.h

@@ -123,7 +123,7 @@ public:
     TextRange normalized_selection() const { return m_selection.normalized(); }
 
     void insert_at_cursor_or_replace_selection(StringView);
-    void replace_all_text_while_keeping_undo_stack(StringView text);
+    void replace_all_text_without_resetting_undo_stack(StringView text);
     bool write_to_file(String const& path);
     bool write_to_file(Core::File&);
     bool has_selection() const { return m_selection.is_valid(); }