From 7d1e49559f2e7244efa2f981fd4fddc0b76d0924 Mon Sep 17 00:00:00 2001 From: eidheim Date: Fri, 29 Jan 2021 13:00:11 +0100 Subject: [PATCH] Fixes #443: added preference item for keeping entry shown after running command --- CMakeLists.txt | 2 +- src/config.cpp | 1 + src/config.hpp | 1 + src/entrybox.cpp | 2 +- src/files.hpp | 3 ++- src/window.cpp | 5 ++++- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 237a2b3..17dec30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(juci) -set(JUCI_VERSION "1.6.2") +set(JUCI_VERSION "1.6.2.1") set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim ") diff --git a/src/config.cpp b/src/config.cpp index da9a25e..d12e4bb 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -209,6 +209,7 @@ void Config::read(const boost::property_tree::ptree &cfg) { 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"); + terminal.hide_entry_on_run_command = cfg.get("terminal.hide_entry_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 c954a78..ec44076 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -27,6 +27,7 @@ public: std::string font; bool clear_on_compile; bool clear_on_run_command; + bool hide_entry_on_run_command; }; class Project { diff --git a/src/entrybox.cpp b/src/entrybox.cpp index 4808400..7320f23 100644 --- a/src/entrybox.cpp +++ b/src/entrybox.cpp @@ -110,6 +110,6 @@ void EntryBox::show() { show_all(); if(entries.size() > 0) { entries.begin()->grab_focus(); - entries.begin()->select_region(0, entries.begin()->get_text_length()); + entries.begin()->select_region(0, -1); } } diff --git a/src/files.hpp b/src/files.hpp index e94e999..74a42b9 100644 --- a/src/files.hpp +++ b/src/files.hpp @@ -84,7 +84,8 @@ const std::string default_config_file = "font_comment": "Use \"\" to use source.font with slightly smaller size", "font": "", "clear_on_compile": true, - "clear_on_run_command": false + "clear_on_run_command": false, + "hide_entry_on_run_command": true }, "project": { "default_build_path_comment": "Use to insert the project top level directory name", diff --git a/src/window.cpp b/src/window.cpp index 26a742e..14fdfa8 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1394,7 +1394,10 @@ void Window::set_menu_actions() { Terminal::get().async_print("\e[2m" + content + " returned: " + (exit_status == 0 ? "\e[32m" : "\e[31m") + std::to_string(exit_status) + "\e[m\n"); }); } - EntryBox::get().hide(); + if(Config::get().terminal.hide_entry_on_run_command) + EntryBox::get().hide(); + else + EntryBox::get().entries.front().select_region(0, -1); }, 30); auto entry_it = EntryBox::get().entries.begin();