From 6facfbbf7a82e1301e53431f013e898ece82f623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 17 Oct 2018 10:17:09 +0200 Subject: [PATCH] [apps/graph] Use TextFieldWithExtension in the list controller --- apps/graph/list/text_field_function_title_cell.cpp | 3 +-- apps/graph/list/text_field_function_title_cell.h | 3 ++- apps/shared/text_field_with_extension.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/graph/list/text_field_function_title_cell.cpp b/apps/graph/list/text_field_function_title_cell.cpp index 03290868b..80f0b4f57 100644 --- a/apps/graph/list/text_field_function_title_cell.cpp +++ b/apps/graph/list/text_field_function_title_cell.cpp @@ -7,7 +7,7 @@ namespace Graph { TextFieldFunctionTitleCell::TextFieldFunctionTitleCell(StorageListController * listController, Orientation orientation, KDText::FontSize size) : Shared::FunctionTitleCell(orientation), Responder(listController), - m_textField(this, m_textFieldBuffer, m_textFieldBuffer, k_textFieldBufferSize, listController, false, size, 0.5f, 0.5f) + m_textField(Shared::StorageFunction::k_parenthesedArgumentLength, this, m_textFieldBuffer, m_textFieldBuffer, k_textFieldBufferSize, listController, false, size, 0.5f, 0.5f) {} void TextFieldFunctionTitleCell::setHighlighted(bool highlight) { @@ -20,7 +20,6 @@ void TextFieldFunctionTitleCell::setEditing(bool editing) { const char * previousText = m_textField.text(); m_textField.setEditing(true, false); m_textField.setText(previousText); - m_textField.setCursorLocation(strlen(previousText) - strlen("(x)")); } void TextFieldFunctionTitleCell::setEven(bool even) { diff --git a/apps/graph/list/text_field_function_title_cell.h b/apps/graph/list/text_field_function_title_cell.h index 2d67692c7..50d8599b0 100644 --- a/apps/graph/list/text_field_function_title_cell.h +++ b/apps/graph/list/text_field_function_title_cell.h @@ -2,6 +2,7 @@ #define GRAPH_LIST_TEXT_FIELD_FUNCTION_TITLE_CELL_H #include +#include namespace Graph { @@ -29,7 +30,7 @@ protected: KDRect textFieldFrame() const; private: constexpr static int k_textFieldBufferSize = TextField::maxBufferSize(); - TextField m_textField; + Shared::TextFieldWithExtension m_textField; char m_textFieldBuffer[k_textFieldBufferSize]; }; diff --git a/apps/shared/text_field_with_extension.h b/apps/shared/text_field_with_extension.h index 18a229de0..cddbed988 100644 --- a/apps/shared/text_field_with_extension.h +++ b/apps/shared/text_field_with_extension.h @@ -12,7 +12,7 @@ public: char * textBuffer, char * draftTextBuffer, size_t textBufferSize, - TextFieldDelegate * delegate = nullptr, + ::TextFieldDelegate * delegate = nullptr, bool hasTwoBuffers = true, KDText::FontSize size = KDText::FontSize::Large, float horizontalAlignment = 0.0f,