From a88a1bcbef58002e65bd359e7d330e53ea8d31cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 4 Mar 2019 16:54:32 +0100 Subject: [PATCH] [escher] Increase TextField::maxBufferSize In order to be able to write a 10*10 adjacency matrix --- escher/include/escher/layout_field.h | 2 +- escher/include/escher/text_field.h | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/escher/include/escher/layout_field.h b/escher/include/escher/layout_field.h index f04ed133b..874719df8 100644 --- a/escher/include/escher/layout_field.h +++ b/escher/include/escher/layout_field.h @@ -49,7 +49,7 @@ protected: bool privateHandleMoveEvent(Ion::Events::Event event, bool * shouldRecomputeLayout); private: - constexpr static int k_maxNumberOfLayouts = 152; + constexpr static int k_maxNumberOfLayouts = 220; static_assert(k_maxNumberOfLayouts == TextField::maxBufferSize(), "Maximal number of layouts in a layout field should be equal to max number of char in text field"); void scrollRightOfLayout(Poincare::Layout layoutR); void scrollToBaselinedRect(KDRect rect, KDCoordinate baseline); diff --git a/escher/include/escher/text_field.h b/escher/include/escher/text_field.h index 2cc18c2dc..c2725a3df 100644 --- a/escher/include/escher/text_field.h +++ b/escher/include/escher/text_field.h @@ -63,8 +63,11 @@ protected: * lengths can reach 70 (ie * [[1.234567e-123*e^(1.234567e-123*i), 1.234567e-123*e^(1.234567e-123*i)]]). * In order to be able to record those output text, k_maxBufferSize must be - * over 70. */ - constexpr static int k_maxBufferSize = 152; + * over 70. + * Furthermore, we want ot be able to write an adjacency matrix of size 10 + * so we need at least 2 brackets + 10 * (2 brackets + 10 digits + 9 commas) + * = 212 characters. */ + constexpr static int k_maxBufferSize = 220; private: void layoutSubviews() override; KDRect glyphFrameAtPosition(const char * buffer, const char * position) const override;