[escher/text_field] Fix handling of \n

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.
This commit is contained in:
Léa Saviot
2020-01-30 16:31:58 +01:00
parent 4b996b333b
commit ae3fa46191
4 changed files with 41 additions and 47 deletions

View File

@@ -20,10 +20,9 @@ bool HasCodePoint(const char * s, CodePoint c);
* stopping at the null-terminating char or the start of string. */
const char * NotCodePointSearch(const char * s, CodePoint c, bool goingLeft = false, const char * initialPosition = nullptr);
/* Copy src into dst while removing all code points c. Also update an index
* that should be lower if code points where removed before it. Ensure null-
/* Copy src into dst while removing all code points in codePoints. Ensure null-
* termination of dst. */
void CopyAndRemoveCodePoint(char * dst, size_t dstSize, const char * src, CodePoint c);
void CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodePoint * codePoints, int numberOfCodePoints);
/* Remove all code points c. and update an index that should be lower if code
* points where removed before it. Ensure null-termination of dst. */