mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion/utf8_helper] Put default parameter in RemovePreviousGlyph
This commit is contained in:
@@ -149,12 +149,11 @@ bool TextField::ContentView::removePreviousGlyph() {
|
||||
|
||||
if (m_horizontalAlignment > 0.0f) {
|
||||
/* Reload the view. If we do it later, the text beins supposedly shorter, we
|
||||
* will not clean the first char. */
|
||||
* will not clean the first char. */
|
||||
reloadRectFromPosition(m_draftTextBuffer);
|
||||
}
|
||||
// Remove the glyph if possible
|
||||
CodePoint removedCodePoint = 0;
|
||||
int removedSize = UTF8Helper::RemovePreviousGlyph(m_draftTextBuffer, const_cast<char *>(cursorLocation()), &removedCodePoint);
|
||||
int removedSize = UTF8Helper::RemovePreviousGlyph(m_draftTextBuffer, const_cast<char *>(cursorLocation()));
|
||||
if (removedSize == 0) {
|
||||
assert(cursorLocation() == m_draftTextBuffer);
|
||||
return false;
|
||||
|
||||
@@ -72,7 +72,7 @@ bool CodePointIsUpperCaseLetter(CodePoint c);
|
||||
bool CodePointIsNumber(CodePoint c);
|
||||
|
||||
// Shift the buffer and return the number of bytes removed.
|
||||
int RemovePreviousGlyph(const char * text, char * location, CodePoint * c);
|
||||
int RemovePreviousGlyph(const char * text, char * location, CodePoint * c = nullptr);
|
||||
|
||||
/* Return the pointer to the (non combining) code point whose glyph is displayed
|
||||
* at the given position, and vice-versa */
|
||||
|
||||
@@ -267,7 +267,6 @@ bool CodePointIsNumber(CodePoint c) {
|
||||
}
|
||||
|
||||
int RemovePreviousGlyph(const char * text, char * location, CodePoint * c) {
|
||||
assert(c != nullptr);
|
||||
if (location <= text) {
|
||||
assert(location == text);
|
||||
return 0;
|
||||
@@ -276,7 +275,9 @@ int RemovePreviousGlyph(const char * text, char * location, CodePoint * c) {
|
||||
// Find the previous glyph
|
||||
UTF8Decoder decoder(text, location);
|
||||
const char * previousGlyphPos = decoder.previousGlyphPosition();
|
||||
*c = decoder.nextCodePoint();
|
||||
if (c != nullptr) {
|
||||
*c = decoder.nextCodePoint();
|
||||
}
|
||||
|
||||
// Shift the buffer
|
||||
int shiftedSize = location - previousGlyphPos;
|
||||
|
||||
Reference in New Issue
Block a user