Explorar el Código

TextEditor: Use an automatic "modified" marker in the window title

This simplifies the application somewhat as we no longer need to
manually update the window title whenever the text document changes.
Andreas Kling hace 4 años
padre
commit
f0cc712246
Se han modificado 1 ficheros con 2 adiciones y 4 borrados
  1. 2 4
      Userland/Applications/TextEditor/MainWidget.cpp

+ 2 - 4
Userland/Applications/TextEditor/MainWidget.cpp

@@ -59,7 +59,7 @@ MainWidget::MainWidget()
 
 
     m_editor->on_change = [this] {
     m_editor->on_change = [this] {
         update_preview();
         update_preview();
-        update_title();
+        window()->set_modified(editor().document().is_modified());
     };
     };
 
 
     m_page_view = *find_descendant_of_type_named<Web::OutOfProcessWebView>("webview");
     m_page_view = *find_descendant_of_type_named<Web::OutOfProcessWebView>("webview");
@@ -605,9 +605,7 @@ void MainWidget::update_title()
         builder.append("Untitled");
         builder.append("Untitled");
     else
     else
         builder.append(m_path);
         builder.append(m_path);
-    if (editor().document().is_modified())
-        builder.append(" (*)");
-    builder.append(" - Text Editor");
+    builder.append("[*] - Text Editor");
     window()->set_title(builder.to_string());
     window()->set_title(builder.to_string());
 }
 }