diff --git a/src/core/entry.cpp b/src/core/entry.cpp index b4b76bce..c7eaffe7 100644 --- a/src/core/entry.cpp +++ b/src/core/entry.cpp @@ -318,6 +318,7 @@ namespace vind void VindEntry::update() { auto& ihub = InputHub::get_instance() ; + auto& settable = SetTable::get_instance() ; // NOTE: it assume that these hwnd are fixed. static const auto desktop_hwnd = GetDesktopWindow() ; @@ -376,27 +377,26 @@ namespace vind continue ; } - auto solver = ihub.get_solver() ; - for(const auto& matcher : solver->get_trigger_matchers()) { - if(matcher->is_matching()) { + if(settable.get("showcmd").get()) { + auto solver = ihub.get_solver() ; + for(const auto& matcher : solver->get_trigger_matchers()) { + if(!matcher->is_matching()) { + continue ; + } auto hist_size = matcher->history_size() ; + // If the any matcher isn't matched, the history size is zero. if(hist_size == 0) { + opt::VCmdLine::reset() ; break ; } - auto cmd = matcher->get_command() ; std::stringstream ss ; - for( - auto itr = cmd.begin() ; - itr < (cmd.begin() + hist_size) ; - itr ++) { - for(auto& key : **itr) { - auto uni = core::keycode_to_unicode(key, **itr) ; - if(!uni.empty()) { - ss << uni ; - } - } + auto cmd = matcher->get_command() ; + auto end_itr = cmd.begin() + hist_size ; + for(auto itr = cmd.begin() ; itr != end_itr ; itr ++) { + ss << **itr ; } - std::cout << ss.str() << std::endl ; + opt::VCmdLine::reset() ; + opt::VCmdLine::print(opt::StaticMessage(ss.str())) ; break ; } } diff --git a/src/core/settable.cpp b/src/core/settable.cpp index 5871310d..9d2ec132 100644 --- a/src/core/settable.cpp +++ b/src/core/settable.cpp @@ -82,6 +82,7 @@ namespace Param("uiacachebuild_stayend", 2000), Param("vcmdline", true), + Param("showcmd", true), Param("vscroll_pageratio", 0.125f), Param("vscroll_speed", 30),