Skip to content

Commit

Permalink
fixed regression searching in multiple nodes, only nodes names and ta…
Browse files Browse the repository at this point in the history
…gs, not working (#2461, #2408)
  • Loading branch information
giuspen committed Mar 26, 2024
1 parent e32309e commit 2a06233
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/ct/ct_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ class CtActions
Glib::RefPtr<Glib::Regex> re_pattern,
bool forward,
bool first_fromsel,
bool all_matches);
bool all_matches,
CtMatchType thisNodeLastMatchType);
bool _parse_node_content_iter(const CtTreeIter& tree_iter,
Glib::RefPtr<Gtk::TextBuffer> text_buffer,
Glib::RefPtr<Glib::Regex> re_pattern,
Expand Down
19 changes: 11 additions & 8 deletions src/ct/ct_actions_find.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ void CtActions::find_in_multiple_nodes_ok_clicked()
break;
}
}
CtMatchType matchType;
CtMatchType matchType{CtMatchType::None};
auto f_matchTypeNotNone = [&](){
matchType = _parse_given_node_content(ct_node_iter, re_pattern, forward, first_fromsel, all_matches);
matchType = _parse_given_node_content(ct_node_iter, re_pattern, forward, first_fromsel, all_matches, matchType);
return CtMatchType::None != matchType;
};
while (f_matchTypeNotNone()) {
++_s_state.matches_num;
if (not all_matches or ctStatusBar.is_progress_stop() or CtMatchType::NameNTags == matchType) break;
if (not all_matches or ctStatusBar.is_progress_stop()) break;
}
++_s_state.processed_nodes;
if (_s_state.matches_num > 0 and not all_matches) break;
Expand Down Expand Up @@ -363,7 +363,8 @@ CtMatchType CtActions::_parse_given_node_content(CtTreeIter node_iter,
Glib::RefPtr<Glib::Regex> re_pattern,
bool forward,
bool first_fromsel,
bool all_matches)
bool all_matches,
CtMatchType thisNodeLastMatchType)
{
const gint64 argNodeId = node_iter.get_node_id();
std::optional<bool> optFirstNode;
Expand Down Expand Up @@ -392,7 +393,9 @@ CtMatchType CtActions::_parse_given_node_content(CtTreeIter node_iter,
return CtMatchType::Content;
}
}
if (_s_options.node_name_n_tags) {
if (_s_options.node_name_n_tags and
(not all_matches or CtMatchType::NameNTags != thisNodeLastMatchType))
{
if (_parse_node_name_n_tags_iter(node_iter, re_pattern, all_matches)) {
if (_s_state.find_iterated_last_name_n_tags_id <= 0 or
_s_state.find_iterated_last_name_n_tags_id != argNodeId)
Expand Down Expand Up @@ -425,14 +428,14 @@ CtMatchType CtActions::_parse_given_node_content(CtTreeIter node_iter,
break;
}
}
CtMatchType matchType;
CtMatchType matchType{CtMatchType::None};
auto f_matchTypeNotNone = [&](){
matchType = _parse_given_node_content(ct_node_iter, re_pattern, forward, first_fromsel, all_matches);
matchType = _parse_given_node_content(ct_node_iter, re_pattern, forward, first_fromsel, all_matches, matchType);
return CtMatchType::None != matchType;
};
while (f_matchTypeNotNone()) {
++_s_state.matches_num;
if (not all_matches or _pCtMainWin->get_status_bar().is_progress_stop() or CtMatchType::NameNTags == matchType) break;
if (not all_matches or _pCtMainWin->get_status_bar().is_progress_stop()) break;
}
if (_s_state.matches_num > 0 and not all_matches) break;
if (forward) child_iter = ++child_iter;
Expand Down

0 comments on commit 2a06233

Please sign in to comment.