void wxExFindResult( const wxString& find_text, bool find_next, bool recursive) { if (!recursive) { const wxString where = (find_next) ? _("bottom"): _("top"); wxLogStatus( _("Searching for") + " " + wxExQuoted(wxExSkipWhiteSpace(find_text)) + " " + _("hit") + " " + where); } else { wxBell(); wxLogStatus( wxExQuoted(wxExSkipWhiteSpace(find_text)) + " " + _("not found")); } }
const std::vector< std::string > wxExViMacros::GetRegisters() const { std::vector< std::string > r; for (const auto& it : m_Macros) { if (it.first.size() == 1) { r.emplace_back(it.first + "=" + wxExSkipWhiteSpace( std::accumulate(it.second.begin(), it.second.end(), std::string()))); } } const std::string clipboard(wxExSkipWhiteSpace(wxExClipboardGet())); if (!clipboard.empty()) { r.emplace_back("*=" + clipboard); } return r; }
const wxArrayString wxExViMacros::GetRegisters() const { wxArrayString as; // Currently the " register does not really exist, // but copies clipboard contents instead. const wxString clipboard(wxExSkipWhiteSpace(wxExClipboardGet())); if (!clipboard.empty()) { as.Add("\": " + clipboard); } for ( std::map<wxString, std::vector< wxString > >::const_iterator it = m_Macros.begin(); it != m_Macros.end(); ++it) { std::vector<wxString> v = it->second; wxString output; for ( std::vector<wxString>::const_iterator it2 = v.begin(); it2 != v.end(); ++it2) { output += *it2; } as.Add(it->first + ": " + wxExSkipWhiteSpace(output)); } return as; }
// Returns 0 and bells on error in address, otherwise the vi line number, // so subtract 1 for stc line number. int wxExEx::ToLineNumber(const wxString& address) const { wxString filtered_address(wxExSkipWhiteSpace(address, "")); // Filter all markers. int markers = 0; while (filtered_address.Contains("'")) { const wxString oper = filtered_address.BeforeFirst('\''); int pos = filtered_address.Find('\''); int size = 2; const wxString marker = filtered_address.AfterFirst('\''); if (marker.empty()) { return 0; } const int line = MarkerLine(marker.GetChar(0)) + 1; if (line == 0) { return 0; } if (oper == "-") { markers -= line; pos--; size++; } else if (oper == "+") { markers += line; pos--; size++; } else { markers += line; } filtered_address.replace(pos, size, ""); } int dot = 0; int stc_used = 0; if (filtered_address.Contains(".")) { dot = m_STC->GetCurrentLine(); filtered_address.Replace(".", ""); stc_used = 1; } // Filter $. int dollar = 0; if (filtered_address.Contains("$")) { dollar = m_STC->GetLineCount(); filtered_address.Replace("$", ""); stc_used = 1; } // Now we should have a number. if (!filtered_address.IsNumber()) { return 0; } // Convert this number. int i = 0; if (!filtered_address.empty()) { if ((i = atoi(filtered_address.c_str())) == 0) { return 0; } } // Calculate the line. const int line_no = markers + dot + dollar + i + stc_used; // Limit the range of what is returned. if (line_no <= 0) { return 1; } else if (line_no > m_STC->GetLineCount()) { return m_STC->GetLineCount(); } else { return line_no; } }