mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 23:30:37 +01:00
[escher/text_input] Factorize and clean handleEvent Right and Left
This commit is contained in:
committed by
EmilieNumworks
parent
5a8596acd7
commit
cc8403e020
@@ -96,6 +96,23 @@ bool TextInput::removeEndOfLine() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TextInput::moveCursorLeft() {
|
||||
if (cursorLocation() <= text()) {
|
||||
assert(cursorLocation() == text());
|
||||
return false;
|
||||
}
|
||||
UTF8Decoder decoder(text(), cursorLocation());
|
||||
return setCursorLocation(decoder.previousGlyphPosition());
|
||||
}
|
||||
|
||||
bool TextInput::moveCursorRight() {
|
||||
if (UTF8Helper::CodePointIs(cursorLocation(), UCodePointNull)) {
|
||||
return false;
|
||||
}
|
||||
UTF8Decoder decoder(cursorLocation());
|
||||
return setCursorLocation(decoder.nextGlyphPosition());
|
||||
}
|
||||
|
||||
bool TextInput::privateRemoveEndOfLine() {
|
||||
return contentView()->removeEndOfLine();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user