editing
This fixes the following bug: in solver, input Matrix(Matrix()) and select the
inner Matrix. When handling "OK" event, the "=0" is inserted at a wrong
position leading to a crash !
When each Calculation had its own text buffer, the Expression of an
overflowing output text was Undefined. Hence that Expression could have
been Undefined without the corresponding text being 'undef'. That situation
may not happen anymore since Calculation are stored in a shared buffer.
The most common case where only the approximate output is displayed
happens when the exact and the approximate outputs are equal, more
precisely when the exact output is equal to the approximate output with
the number of significant digits taken from user settings. That
clarification matters for the Poincare::Integers which have more digits than
the number of significant digits set by the user.
Besides, an Expression containing Units is simplified as
Multiplication(Float, Unit...) recorded identically into the exact and
the approximate outputs (except perhaps the number of significant
digits). Generally, the case where the number of digits in the output is
smaller or equal to the user setting would be matched by the condition,
stated above, that exact and approximate output are equal. But that
should also be the case whatever the number of significant digits. That
is why the presence of Units is matched specifically.
when a text cannot be inserted because it overflows the buffer, don't
add anything
insertTextAtLocation already behaves like this but handleEventWithText
used to cap the inserted text which sometimes leads to a different
behaviour - it would insert a truncated text
Solve an equation that has solutions, select a solution, then go back
and change the equation. WHen you go to the solutions, the previous
solution is still selected, which is a little weird
probably due to gc_collect (we suspect that transpiled C does not have
access to javascript variables preventing it from collecting all
required roots and leading to deleting objects prematuraly). Enabling
PyStack reduces the use of the heap and fixes the bug.
The buffer length did not take into account the \n removal. In fact, we
could just remove the \n while also removing the empty code points,
which is what we do now.