| 54 | } |
| 55 | |
| 56 | static std::string getReplaceText( const ProjectSearch::ResultData::Result& result, |
| 57 | const std::string& replaceText ) { |
| 58 | std::string newText( replaceText ); |
| 59 | LuaPattern ptrn( "$(%d+)" ); |
| 60 | for ( auto& match : ptrn.gmatch( replaceText ) ) { |
| 61 | std::string matchSubStr( match.group( 0 ) ); // $1, $2, etc. |
| 62 | std::string matchNum( match.group( 1 ) ); // 1, 2, etc. |
| 63 | int num; |
| 64 | if ( String::fromString( num, matchNum ) && num > 0 && |
| 65 | num - 1 < static_cast<int>( result.captures.size() ) ) { |
| 66 | String::replaceAll( newText, matchSubStr, result.captures[num - 1] ); |
| 67 | } |
| 68 | } |
| 69 | return newText; |
| 70 | } |
| 71 | |
| 72 | void GlobalSearchController::processNextReplaceInBuffer( |
| 73 | std::string&& replaceText, ProjectSearch::SearchConfig&& searchConfig, |
no test coverage detected