delete carriage returns instead of turning them into blanks, add final newline

This commit is contained in:
Axel Kohlmeyer
2023-08-25 18:39:34 -04:00
parent 9c91ec9050
commit 0461fe8a13

View File

@ -636,6 +636,7 @@ void lammps_commands_string(void *handle, const char *str)
bool append = false; bool append = false;
bool triple = false; bool triple = false;
if (str) buffer = str; if (str) buffer = str;
buffer += '\n';
BEGIN_CAPTURE BEGIN_CAPTURE
{ {
@ -655,7 +656,8 @@ void lammps_commands_string(void *handle, const char *str)
cursor = buffer.find('\n', start); cursor = buffer.find('\n', start);
if (cursor != std::string::npos) { if (cursor != std::string::npos) {
line = buffer.substr(start, cursor-start); line = buffer.substr(start, cursor-start);
std::replace(line.begin(), line.end(), '\r', ' '); auto start_erase = std::remove(line.begin(), line.end(), '\r');
line.erase(start_erase, line.end());
++cursor; ++cursor;
lmp->output->thermo->set_line(nline); lmp->output->thermo->set_line(nline);
} else { } else {