diff --git a/CMakeLists.txt b/CMakeLists.txt index 8482621..038b82c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.8.8) project(juci) -set(JUCI_VERSION "1.6.0.6") +set(JUCI_VERSION "1.6.0.7") set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim ") diff --git a/src/config.cpp b/src/config.cpp index 849400d..281a8e2 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -198,7 +198,6 @@ void Config::read(const boost::property_tree::ptree &cfg) { project.meson.compile_command = cfg.get("project.meson.compile_command"); project.default_build_management_system = cfg.get("project.default_build_management_system"); project.save_on_compile_or_run = cfg.get("project.save_on_compile_or_run"); - project.clear_terminal_on_compile = cfg.get("project.clear_terminal_on_compile"); project.ctags_command = cfg.get("project.ctags_command"); project.grep_command = cfg.get("project.grep_command"); project.cargo_command = cfg.get("project.cargo_command"); @@ -207,6 +206,8 @@ void Config::read(const boost::property_tree::ptree &cfg) { terminal.history_size = cfg.get("terminal.history_size"); terminal.font = cfg.get("terminal.font"); + terminal.clear_on_compile = cfg.get("terminal.clear_on_compile"); + terminal.clear_on_run_command = cfg.get("terminal.clear_on_run_command"); log.libclang = cfg.get("log.libclang"); log.language_server = cfg.get("log.language_server"); diff --git a/src/config.hpp b/src/config.hpp index 804ade3..af5dac5 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -25,6 +25,8 @@ public: public: int history_size; std::string font; + bool clear_on_compile; + bool clear_on_run_command; }; class Project { @@ -46,7 +48,6 @@ public: Meson meson; std::string default_build_management_system; bool save_on_compile_or_run; - bool clear_terminal_on_compile; std::string ctags_command; std::string grep_command; std::string cargo_command; diff --git a/src/files.hpp b/src/files.hpp index 3541ddc..8b187f9 100644 --- a/src/files.hpp +++ b/src/files.hpp @@ -77,7 +77,45 @@ const std::string default_config_file = R"RAW({ "terminal": { "history_size": 10000, "font_comment": "Use \"\" to use source.font with slightly smaller size", - "font": "" + "font": "", + "clear_on_compile": true, + "clear_on_run_command": false + }, + "project": { + "default_build_path_comment": "Use to insert the project top level directory name", + "default_build_path": "./build", + "debug_build_path_comment": "Use to insert the project top level directory name, and to insert your default_build_path setting.", + "debug_build_path": "/debug", + "cmake": {)RAW" +#ifdef _WIN32 + R"RAW( + "command": "cmake -G\"MSYS Makefiles\"",)RAW" +#else + R"RAW( + "command": "cmake",)RAW" +#endif + R"RAW( + "compile_command": "cmake --build ." + }, + "meson": { + "command": "meson", + "compile_command": "ninja" + }, + "default_build_management_system_comment": "Select which build management system to use when creating a new C or C++ project, for instance \"cmake\" or \"meson\"", + "default_build_management_system": "cmake", + "save_on_compile_or_run": true,)RAW" +#ifdef JUCI_USE_UCTAGS + R"RAW( + "ctags_command": "uctags",)RAW" +#else + R"RAW( + "ctags_command": "ctags",)RAW" +#endif + R"RAW( + "grep_command": "grep", + "cargo_command": "cargo", + "python_command": "PYTHONUNBUFFERED=1 python", + "markdown_command": "grip -b" }, "keybindings": { "preferences": "comma", @@ -177,43 +215,6 @@ const std::string default_config_file = R"RAW({ "window_toggle_zen_mode": "", "window_clear_terminal": "" }, - "project": { - "default_build_path_comment": "Use to insert the project top level directory name", - "default_build_path": "./build", - "debug_build_path_comment": "Use to insert the project top level directory name, and to insert your default_build_path setting.", - "debug_build_path": "/debug", - "cmake": {)RAW" -#ifdef _WIN32 - R"RAW( - "command": "cmake -G\"MSYS Makefiles\"",)RAW" -#else - R"RAW( - "command": "cmake",)RAW" -#endif - R"RAW( - "compile_command": "cmake --build ." - }, - "meson": { - "command": "meson", - "compile_command": "ninja" - }, - "default_build_management_system_comment": "Select which build management system to use when creating a new C or C++ project, for instance \"cmake\" or \"meson\"", - "default_build_management_system": "cmake", - "save_on_compile_or_run": true, - "clear_terminal_on_compile": true,)RAW" -#ifdef JUCI_USE_UCTAGS - R"RAW( - "ctags_command": "uctags",)RAW" -#else - R"RAW( - "ctags_command": "ctags",)RAW" -#endif - R"RAW( - "grep_command": "grep", - "cargo_command": "cargo", - "python_command": "PYTHONUNBUFFERED=1 python", - "markdown_command": "grip -b" - }, "documentation_searches": { "clang": { "separator": "::", diff --git a/src/project.cpp b/src/project.cpp index 7051e94..c4e7184 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -372,7 +372,7 @@ void Project::LLDB::debug_start() { debugging = true; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Compiling and debugging " + *run_arguments + "\n"); @@ -843,7 +843,7 @@ void Project::Clang::compile() { compiling = true; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Compiling project " + filesystem::get_short_path(build->project_path).string() + "\n"); @@ -877,7 +877,7 @@ void Project::Clang::compile_and_run() { compiling = true; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Compiling and running " + arguments + "\n"); @@ -986,7 +986,7 @@ void Project::Python::compile_and_run() { path = view->file_path.parent_path(); } - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Running " + command + "\n"); @@ -1012,7 +1012,7 @@ void Project::JavaScript::compile_and_run() { path = view->file_path.parent_path(); } - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Running " + command + "\n"); @@ -1025,7 +1025,7 @@ void Project::HTML::compile_and_run() { if(dynamic_cast(build.get())) { std::string command = "npm start"; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Running " + command + "\n"); @@ -1053,7 +1053,7 @@ std::pair Project::Rust::get_run_arguments() { void Project::Rust::compile() { compiling = true; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); Terminal::get().print("Compiling project " + filesystem::get_short_path(build->project_path).string() + "\n"); @@ -1067,7 +1067,7 @@ void Project::Rust::compile() { void Project::Rust::compile_and_run() { compiling = true; - if(Config::get().project.clear_terminal_on_compile) + if(Config::get().terminal.clear_on_compile) Terminal::get().clear(); auto arguments = get_run_arguments().second; diff --git a/src/window.cpp b/src/window.cpp index 60f96bb..50dadde 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1381,6 +1381,8 @@ void Window::set_menu_actions() { if(!content.empty()) { last_run_command = content; auto directory_folder = Project::get_preferably_directory_folder(); + if(Config::get().terminal.clear_on_run_command) + Terminal::get().clear(); Terminal::get().async_print("Running: " + content + '\n'); Terminal::get().async_process(content, directory_folder, [content](int exit_status) { @@ -1489,8 +1491,11 @@ void Window::set_menu_actions() { EntryBox::get().clear(); EntryBox::get().entries.emplace_back(last_run_debug_command, [this](const std::string &content) { if(!content.empty()) { - if(Project::current) + if(Project::current) { + if(Config::get().terminal.clear_on_run_command) + Terminal::get().clear(); Project::current->debug_run_command(content); + } last_run_debug_command = content; } EntryBox::get().hide();