Shortcut editor ok?

This commit is contained in:
Jean-Francois Dockes
2021-01-20 15:19:27 +01:00
parent ea9a9f511f
commit d2ce3845d0
17 changed files with 261 additions and 122 deletions
+10 -10
View File
@@ -264,20 +264,18 @@ template <class T> bool stringToStrings(const string& s, T& tokens,
template <class T> void stringsToString(const T& tokens, string& s)
{
for (auto it = tokens.begin();
it != tokens.end(); it++) {
bool hasblanks = false;
if (it->find_first_of(" \t\n") != string::npos) {
hasblanks = true;
}
if (it != tokens.begin()) {
s.append(1, ' ');
if (tokens.empty())
return;
for (const auto& tok : tokens) {
if (tok.empty()) {
s.append("\"\" ");
continue;
}
bool hasblanks = tok.find_first_of(" \t\n") != string::npos;
if (hasblanks) {
s.append(1, '"');
}
for (unsigned int i = 0; i < it->length(); i++) {
char car = it->at(i);
for (auto car : tok) {
if (car == '"') {
s.append(1, '\\');
s.append(1, car);
@@ -288,7 +286,9 @@ template <class T> void stringsToString(const T& tokens, string& s)
if (hasblanks) {
s.append(1, '"');
}
s.append(1, ' ');
}
s.resize(s.size()-1);
}
template <class T> string stringsToString(const T& tokens)