diff --git a/escher/include/escher/text_area.h b/escher/include/escher/text_area.h index c885b63b8..03af4f6fe 100644 --- a/escher/include/escher/text_area.h +++ b/escher/include/escher/text_area.h @@ -66,7 +66,7 @@ private: void insertChar(char c, size_t index); char removeChar(size_t index); - int removeRemainingLine(size_t index, int direction); + size_t removeRemainingLine(size_t index, int direction); char operator[](size_t index) { assert(index < m_bufferSize); return m_buffer[index]; diff --git a/escher/src/text_area.cpp b/escher/src/text_area.cpp index 61892a169..f47316aa2 100644 --- a/escher/src/text_area.cpp +++ b/escher/src/text_area.cpp @@ -107,14 +107,14 @@ char TextArea::Text::removeChar(size_t index) { return deletedChar; } -int TextArea::Text::removeRemainingLine(size_t index, int direction) { +size_t TextArea::Text::removeRemainingLine(size_t index, int direction) { assert(m_buffer != nullptr); assert(index < m_bufferSize); int jump = index; while (m_buffer[jump] != '\n' && m_buffer[jump] != 0 && jump >= 0) { jump += direction; } - int delta = direction > 0 ? jump - index : index - jump; + size_t delta = direction > 0 ? jump - index : index - jump; if (delta == 0) { return 0; } @@ -240,7 +240,7 @@ bool TextArea::TextArea::ContentView::removeChar() { } bool TextArea::ContentView::removeEndOfLine() { - int removedLine = m_text.removeRemainingLine(cursorLocation(), 1); + size_t removedLine = m_text.removeRemainingLine(cursorLocation(), 1); if (removedLine > 0) { layoutSubviews(); reloadRectFromCursorPosition(cursorLocation(), false); @@ -253,7 +253,7 @@ bool TextArea::ContentView::removeStartOfLine() { if (cursorLocation() <= 0) { return false; } - int removedLine = m_text.removeRemainingLine(cursorLocation()-1, -1); + size_t removedLine = m_text.removeRemainingLine(cursorLocation()-1, -1); if (removedLine > 0) { assert(m_cursorIndex >= removedLine); setCursorLocation(cursorLocation()-removedLine);