浏览代码

Help: Always show the welcome page on launch if nothing else is there

Previously, launching Help with a query like `Help tar` left the page
blank, which looks like something has gone wrong. Instead, let's show
the usual welcome page.
Sam Atkins 3 年之前
父节点
当前提交
4bf2ef2a4c
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      Userland/Applications/Help/main.cpp

+ 4 - 2
Userland/Applications/Help/main.cpp

@@ -274,12 +274,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
         context_menu->popup(screen_position);
         context_menu->popup(screen_position);
     };
     };
 
 
+    bool set_start_page = false;
     if (start_page) {
     if (start_page) {
         URL url = URL::create_with_url_or_path(start_page);
         URL url = URL::create_with_url_or_path(start_page);
         if (url.is_valid() && url.path().ends_with(".md")) {
         if (url.is_valid() && url.path().ends_with(".md")) {
             history.push(url.path());
             history.push(url.path());
             update_actions();
             update_actions();
             open_page(url.path());
             open_page(url.path());
+            set_start_page = true;
         } else {
         } else {
             left_tab_bar->set_active_widget(search_view);
             left_tab_bar->set_active_widget(search_view);
             search_box->set_text(start_page);
             search_box->set_text(start_page);
@@ -288,9 +290,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
                 search_model.set_filter_term(search_box->text());
                 search_model.set_filter_term(search_box->text());
             }
             }
         }
         }
-    } else {
-        go_home_action->activate();
     }
     }
+    if (!set_start_page)
+        go_home_action->activate();
 
 
     auto statusbar = TRY(widget->try_add<GUI::Statusbar>());
     auto statusbar = TRY(widget->try_add<GUI::Statusbar>());
     app->on_action_enter = [&statusbar](GUI::Action const& action) {
     app->on_action_enter = [&statusbar](GUI::Action const& action) {