add completer for extra/* arguments to read_data
This commit is contained in:
@ -143,7 +143,8 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
||||
minimize_comp(new QCompleter(this)), variable_comp(new QCompleter(this)),
|
||||
units_comp(new QCompleter(this)), group_comp(new QCompleter(this)),
|
||||
varname_comp(new QCompleter(this)), fixid_comp(new QCompleter(this)),
|
||||
compid_comp(new QCompleter(this)), file_comp(new QCompleter(this)), highlight(NO_HIGHLIGHT)
|
||||
compid_comp(new QCompleter(this)), file_comp(new QCompleter(this)),
|
||||
extra_comp(new QCompleter(this)), highlight(NO_HIGHLIGHT)
|
||||
{
|
||||
help_action = new QShortcut(QKeySequence::fromString("Ctrl+?"), parent);
|
||||
connect(help_action, &QShortcut::activated, this, &CodeEditor::get_help);
|
||||
@ -180,6 +181,7 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
||||
COMPLETER_SETUP(fixid_comp);
|
||||
COMPLETER_SETUP(compid_comp);
|
||||
COMPLETER_SETUP(file_comp);
|
||||
COMPLETER_SETUP(extra_comp);
|
||||
#undef COMPLETER_SETUP
|
||||
|
||||
// initialize help system
|
||||
@ -248,6 +250,7 @@ CodeEditor::~CodeEditor()
|
||||
delete fixid_comp;
|
||||
delete compid_comp;
|
||||
delete file_comp;
|
||||
delete extra_comp;
|
||||
}
|
||||
|
||||
int CodeEditor::lineNumberAreaWidth()
|
||||
@ -396,6 +399,7 @@ COMPLETER_INIT_FUNC(integrate, Integrate)
|
||||
COMPLETER_INIT_FUNC(minimize, Minimize)
|
||||
COMPLETER_INIT_FUNC(variable, Variable)
|
||||
COMPLETER_INIT_FUNC(units, Units)
|
||||
COMPLETER_INIT_FUNC(extra, Extra)
|
||||
|
||||
#undef COMPLETER_INIT_FUNC
|
||||
|
||||
@ -1051,6 +1055,8 @@ void CodeEditor::runCompletion()
|
||||
current_comp = fixid_comp;
|
||||
else if (selected.startsWith("F_"))
|
||||
current_comp = fixid_comp;
|
||||
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||
current_comp = extra_comp;
|
||||
else if ((words[0] == "fitpod") || (words[0] == "molecule")) {
|
||||
if (selected.contains('/')) {
|
||||
if (popup && popup->isVisible()) popup->hide();
|
||||
@ -1099,6 +1105,8 @@ void CodeEditor::runCompletion()
|
||||
current_comp = fixid_comp;
|
||||
else if (selected.startsWith("F_"))
|
||||
current_comp = fixid_comp;
|
||||
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||
current_comp = extra_comp;
|
||||
|
||||
if (current_comp) {
|
||||
current_comp->setCompletionPrefix(words[3].c_str());
|
||||
@ -1128,6 +1136,8 @@ void CodeEditor::runCompletion()
|
||||
current_comp = fixid_comp;
|
||||
else if (selected.startsWith("F_"))
|
||||
current_comp = fixid_comp;
|
||||
else if ((words[0] == "read_data") && selected.startsWith("ex"))
|
||||
current_comp = extra_comp;
|
||||
|
||||
if (current_comp) {
|
||||
current_comp->setCompletionPrefix(selected);
|
||||
@ -1265,14 +1275,14 @@ void CodeEditor::open_url()
|
||||
|
||||
void CodeEditor::view_file()
|
||||
{
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
||||
guimain->view_file(act->data().toString());
|
||||
}
|
||||
|
||||
void CodeEditor::inspect_file()
|
||||
{
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
auto *guimain = qobject_cast<LammpsGui *>(parent());
|
||||
guimain->inspect_file(act->data().toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user