[expression_editor] Insert an empty matrix when adding a bracket.

Change-Id: I5bf6ab9e097637e0e49f0941fe02e4f5a8e373a2
This commit is contained in:
Léa Saviot
2018-01-10 11:27:10 +01:00
parent 663c90f764
commit 2c562fdf7a
3 changed files with 24 additions and 3 deletions

View File

@@ -130,9 +130,14 @@ ExpressionLayout * Controller::handleAddEvent(Ion::Events::Event event) {
}
if (event.hasText()) {
const char * textToInsert = event.text();
if (textToInsert[0] == Ion::Charset::MultiplicationSign && textToInsert[1] == 0) {
const char middleDotString[] = {Ion::Charset::MiddleDot, 0};
return m_cursor.insertText(middleDotString);
if (textToInsert[1] == 0) {
if (textToInsert[0] == Ion::Charset::MultiplicationSign) {
const char middleDotString[] = {Ion::Charset::MiddleDot, 0};
return m_cursor.insertText(middleDotString);
}
if (textToInsert[0] == '[' || textToInsert[0] == ']') {
return m_cursor.addEmptyMatrixLayout();
}
}
return m_cursor.insertText(textToInsert);
}