mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 14:20:39 +01:00
[apps/sequence] Fix the insertion of sequence terms in text fields.
For instance, the serialization of the V_n layout is "v_{n}", which is
what we want to insert in an EditableExpressionView, but not in a Text
Field for which we want "v(n)".
Change-Id: Iab38058d982322891b530b3afd2d303a266643f9
This commit is contained in:
@@ -115,7 +115,26 @@ bool SequenceToolbox::selectAddedCell(int selectedRow){
|
||||
int bufferSize = 10;
|
||||
char buffer[bufferSize];
|
||||
m_addedCellLayout[selectedRow]->writeTextInBuffer(buffer, bufferSize);
|
||||
m_action(sender(), buffer);
|
||||
if (m_action == MathToolbox::actionForTextField) {
|
||||
// DIRTY. The symbols are layouted using a Subscript VerticalOffsetLayout,
|
||||
// which serializes into "_{}", but we want parentheses for text fields. We
|
||||
// thus need to remove any underscores, and changes brackets into
|
||||
// parentheses.
|
||||
for (int i = 0; i < bufferSize; i++) {
|
||||
if (buffer[i] == '{') {
|
||||
buffer[i] = '(';
|
||||
}
|
||||
if (buffer[i] == '}') {
|
||||
buffer[i] = ')';
|
||||
}
|
||||
if (buffer[i] == '_') {
|
||||
memmove(&buffer[i], &buffer[i+1], bufferSize - (i+1) + 1);
|
||||
bufferSize--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_action(sender(), buffer, false);
|
||||
app()->dismissModalViewController();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user