[apps/shared] EditableCellTableViewController: adjust column width to be

able to display float like "-1.234567E-123"
This commit is contained in:
Émilie Feral
2019-09-25 10:53:44 +02:00
committed by LeaNumworks
parent 501f7ed8af
commit d6ad694b76
9 changed files with 28 additions and 40 deletions

View File

@@ -124,13 +124,14 @@ void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, in
willDisplayCellAtLocationWithDisplayMode(cell, i, j, Preferences::sharedPreferences()->displayMode());
// The cell is not a title cell and not editable
if (typeAtLocation(i,j) == k_notEditableValueCellType) {
char buffer[2*PrintFloat::bufferSizeForFloatsWithPrecision(Preferences::LargeNumberOfSignificantDigits)+3];//(??;??)
constexpr int bufferSize = 2*PrintFloat::bufferSizeForFloatsWithPrecision(Preferences::LargeNumberOfSignificantDigits)+3;
char buffer[bufferSize]; // The largest buffer holds (-1.234567E-123;-1.234567E-123)
// Special case: last row
if (j == numberOfElementsInColumn(i) + 1) {
buffer[0] = 0;
} else {
double x = intervalAtColumn(i)->element(j-1);
printEvaluationOfAbscissaAtColumn(x, i, buffer, cellBufferSize(i));
printEvaluationOfAbscissaAtColumn(x, i, buffer, bufferSize);
}
static_cast<EvenOddBufferTextCell *>(cell)->setText(buffer);
}