diff --git a/clink/lib/src/matches_impl.cpp b/clink/lib/src/matches_impl.cpp index c0704bc28..a5a73ff7b 100644 --- a/clink/lib/src/matches_impl.cpp +++ b/clink/lib/src/matches_impl.cpp @@ -190,13 +190,7 @@ bool matches_iter::next() while (match_len && path::is_separator((unsigned char)match[match_len - 1])) match_len--; if (path::match_wild(m_pattern, str_iter(match, match_len))) - { - if (is_pathish(get_match_type())) - m_any_pathish = true; - else - m_all_pathish = false; - return true; - } + goto found; } } @@ -204,7 +198,12 @@ bool matches_iter::next() if (m_index >= m_matches.get_match_count()) return false; m_next++; - assert(!m_has_pattern); // Must not exit through here (m_any_pathish, etc). + +found: + if (is_pathish(get_match_type())) + m_any_pathish = true; + else + m_all_pathish = false; return true; } diff --git a/clink/lib/src/rl/rl_module.cpp b/clink/lib/src/rl/rl_module.cpp index 18eaf0cbc..14f582fd5 100644 --- a/clink/lib/src/rl/rl_module.cpp +++ b/clink/lib/src/rl/rl_module.cpp @@ -447,7 +447,7 @@ static char** alternative_matches(const char* text, int start, int end) #ifdef DEBUG if (debug_matches) { - printf("count = %d\n", count - 1); + printf("count = %d\n", count); printf("filename completion desired = %d (%s)\n", rl_filename_completion_desired, iter.is_filename_completion_desired().is_explicit() ? "explicit" : "implicit"); printf("filename display desired = %d (%s)\n", rl_filename_display_desired, iter.is_filename_display_desired().is_explicit() ? "explicit" : "implicit"); printf("is suppress append = %d\n", s_matches->is_suppress_append());