Skip to content

Commit

Permalink
fix defects
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Aug 6, 2023
1 parent 5d8011d commit fa4eba6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions src/core/autocmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ namespace
{}

explicit AutoPattern(const std::string& pat)
: pat_(pat)
: pat_(pat),
re_()
{
init_regex() ;
}

explicit AutoPattern(std::string&& pat)
: pat_(std::move(pat))
: pat_(std::move(pat)),
re_()
{
init_regex() ;
}
Expand All @@ -80,9 +82,9 @@ namespace
std::vector<SequentialCmd> seqcmds_ ;

int get_pat_index(const std::string& query) {
for(int i = 0 ; i < pats_.size() ; i ++) {
for(std::size_t i = 0 ; i < pats_.size() ; i ++) {
if(pats_[i].get() == query) {
return i ;
return static_cast<int>(i) ;
}
}
return -1 ;
Expand Down Expand Up @@ -146,9 +148,9 @@ namespace
}

void match_pattern(const std::string& query, std::unordered_set<int>& indices) {
for(int i = 0 ; i < pats_.size() ; i ++) {
for(std::size_t i = 0 ; i < pats_.size() ; i ++) {
if(pats_[i].match(query)) {
indices.insert(i) ;
indices.insert(static_cast<int>(i)) ;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/autocmd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace vind

AutoCmdEvent get_autocmd_event(const std::string& event_name) noexcept ;

inline AutoCmdEvent get_leave_event(Mode mode) noexcept {
inline AutoCmdEvent get_leave_event(Mode mode) {
static const std::unordered_map<Mode, AutoCmdEvent> leave_events {
{Mode::GUI_NORMAL, AutoCmdEvent::GUI_NORMAL_LEAVE},
{Mode::GUI_VISUAL, AutoCmdEvent::GUI_VISUAL_LEAVE},
Expand All @@ -54,7 +54,7 @@ namespace vind
return AutoCmdEvent::UNDEFINED ;
}

inline AutoCmdEvent get_enter_event(Mode mode) noexcept {
inline AutoCmdEvent get_enter_event(Mode mode) {
static const std::unordered_map<Mode, AutoCmdEvent> enter_events {
{Mode::GUI_NORMAL, AutoCmdEvent::GUI_NORMAL_ENTER},
{Mode::GUI_VISUAL, AutoCmdEvent::GUI_VISUAL_ENTER},
Expand Down
4 changes: 2 additions & 2 deletions src/core/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ namespace vind
DWORD procid ;
if(hwnd && GetWindowThreadProcessId(hwnd, &procid)) {
if(pimpl->previous_procid_ != procid) {
ac.apply_autocmds(AutoCmdEvent::PROC_LEAVE, pimpl->previous_procid_) ;
ac.apply_autocmds(AutoCmdEvent::APP_LEAVE, pimpl->previous_procid_) ;
pimpl->previous_procid_ = procid ;
ac.apply_autocmds(AutoCmdEvent::PROC_ENTER, procid) ;
ac.apply_autocmds(AutoCmdEvent::APP_ENTER, procid) ;
}
}

Expand Down

0 comments on commit fa4eba6

Please sign in to comment.