diff --git a/gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts b/gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts index ed74e272b..65f29b43e 100644 --- a/gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts +++ b/gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts @@ -716,9 +716,12 @@ export class CommandsManager { break; - case ClassType.Group: + case ClassType.Group: + if (await CommandsManager.selectVar(mouseX,mouseY)) + await CommandsManager.editVar(); + else await CommandsManager.editItem(ClassType.Group); - break; + break; case ClassType.Item: await CommandsManager.postNote('item'); diff --git a/model/group.cc b/model/group.cc index 88a4c8e8c..352a510c8 100644 --- a/model/group.cc +++ b/model/group.cc @@ -516,10 +516,10 @@ namespace minsky } } - VariablePtr Group::addIOVar() + VariablePtr Group::addIOVar(const char* prefix) { VariablePtr v(VariableType::flow, - uqName(cminsky().variableValues.newName(to_string(size_t(this))+":"))); + uqName(cminsky().variableValues.newName(to_string(size_t(this))+":"+prefix))); addItem(v,true); createdIOvariables.push_back(v); v->rotation(rotation()); diff --git a/model/group.h b/model/group.h index 6f63cdba3..3bfc90ae4 100644 --- a/model/group.h +++ b/model/group.h @@ -219,7 +219,7 @@ namespace minsky class Group: public ItemT, public GroupItems, public CallableFunction { bool m_displayContentsChanged=true; - VariablePtr addIOVar(); + VariablePtr addIOVar(const char*); protected: /// returns the smallest group whose icon completely encloses the /// rectangle given by the argument. If no candidate group found, @@ -290,8 +290,8 @@ namespace minsky /// check if item is a variable and located in an I/O region, and add it if it is void checkAddIORegion(const ItemPtr& x); - void addInputVar() {inVariables.push_back(addIOVar());} - void addOutputVar() {outVariables.push_back(addIOVar());} + void addInputVar() {inVariables.push_back(addIOVar("input"));} + void addOutputVar() {outVariables.push_back(addIOVar("output"));} /// remove item from group, and also all attached wires. void deleteItem(const Item&); diff --git a/test/testModel.cc b/test/testModel.cc index d57bc1fba..1d8591422 100644 --- a/test/testModel.cc +++ b/test/testModel.cc @@ -108,7 +108,7 @@ SUITE(Group) TEST_FIXTURE(TestFixture, accessibleVars) { vector globalAccessibleVars{"c"}; - vector group0AccessibleVars{"1",":c","a","b"}; + vector group0AccessibleVars{":c","a","b","output1"}; group0->makeSubroutine(); CHECK_EQUAL(globalAccessibleVars.size(), model->accessibleVars().size()); CHECK_ARRAY_EQUAL(globalAccessibleVars, model->accessibleVars(), globalAccessibleVars.size());