[solver] Delete equation at first backspace event (instead of clearing

the expression as in Graph/Sequence)
This commit is contained in:
Émilie Feral
2018-06-04 16:54:43 +02:00
parent bc33b10368
commit 56d23c213d
3 changed files with 7 additions and 1 deletions

View File

@@ -20,6 +20,9 @@ public:
Poincare::ExpressionLayout * layout();
virtual bool isDefined();
virtual bool isEmpty();
virtual bool shouldBeClearedBeforeRemove() {
return !isEmpty();
}
virtual void setContent(const char * c);
virtual void tidy();
private:

View File

@@ -70,7 +70,7 @@ bool ExpressionModelListController::handleEventOnExpression(Ion::Events::Event e
}
if (event == Ion::Events::Backspace && !isAddEmptyRow(selectedRow())) {
ExpressionModel * model = modelStore()->modelAtIndex(modelIndexForRow(selectedRow()));
if (!model->isEmpty()) {
if (model->shouldBeClearedBeforeRemove()) {
reinitExpression(model);
} else {
if (removeModelRow(model)) {

View File

@@ -15,6 +15,9 @@ public:
Equation(Equation&& other) = delete;
void setContent(const char * c) override;
void tidy() override;
bool shouldBeClearedBeforeRemove() override {
return false;
}
Poincare::Expression * standardForm(Poincare::Context * context) const;
private:
mutable Poincare::Expression * m_standardForm;