From 7a9aa7950c85fb9926a50bdded91a9839a26a162 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 31 Aug 2023 21:58:39 -0400 Subject: [PATCH] add special case formatting for *_coeff commands --- tools/lammps-gui/codeeditor.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index 823233b7b2..0f2c5eab70 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -206,7 +206,6 @@ void CodeEditor::setHighlight(int block, bool error) repaint(); } - // reformat line QString CodeEditor::reformatLine(const QString &line) @@ -228,6 +227,18 @@ QString CodeEditor::reformatLine(const QString &line) for (int i = 1; i < words.size(); ++i) { newtext += ' '; newtext += words[i].c_str(); + + // special cases + + // additional space for types or type ranges + if ((words[0] == "pair_coeff") && (i < 3)) + for (int j = words[i].size(); j < 4; ++j) + newtext += ' '; + + if ((i < 2) && ((words[0] == "bond_coeff") || (words[0] == "angle_coeff") || + (words[0] == "dihedral_coeff") || (words[0] == "improper_coeff"))) + for (int j = words[i].size(); j < 4; ++j) + newtext += ' '; } } return newtext;