mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/escher] Factorize TxtArea and Code::EditorCtrlr's k_indentSpaces
This commit is contained in:
@@ -82,8 +82,8 @@ bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events:
|
||||
cursorIsPrecededOnTheLineBySpacesOnly = true;
|
||||
}
|
||||
numberOfSpaces = numberOfSpaces / UTF8Decoder::CharSizeOfCodePoint(' ');
|
||||
if (cursorIsPrecededOnTheLineBySpacesOnly && numberOfSpaces >= k_indentationSpacesNumber) {
|
||||
for (int i = 0; i < k_indentationSpacesNumber; i++) {
|
||||
if (cursorIsPrecededOnTheLineBySpacesOnly && numberOfSpaces >= TextArea::k_indentationSpaces) {
|
||||
for (int i = 0; i < TextArea::k_indentationSpaces; i++) {
|
||||
textArea->removePreviousGlyph();
|
||||
}
|
||||
return true;
|
||||
@@ -96,11 +96,11 @@ bool EditorController::textAreaDidReceiveEvent(TextArea * textArea, Ion::Events:
|
||||
assert(firstNonSpace >= text);
|
||||
if (UTF8Helper::CodePointIs(firstNonSpace, '\n')) {
|
||||
assert(UTF8Decoder::CharSizeOfCodePoint(' ') == 1);
|
||||
char indentationBuffer[k_indentationSpacesNumber+1];
|
||||
for (int i = 0; i < k_indentationSpacesNumber; i++) {
|
||||
char indentationBuffer[TextArea::k_indentationSpaces+1];
|
||||
for (int i = 0; i < TextArea::k_indentationSpaces; i++) {
|
||||
indentationBuffer[i] = ' ';
|
||||
}
|
||||
indentationBuffer[k_indentationSpacesNumber] = 0;
|
||||
indentationBuffer[TextArea::k_indentationSpaces] = 0;
|
||||
textArea->handleEventWithText(indentationBuffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user