mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/escher/toolbox] handleEventWithText for all responders.
This makes the code in the various toolbox more generic. The arguments of the text to insert are each replaced by a Ion::Charset::Empty. These Empty chars are used to create layouts in ExpressionLayoutFields, and to compute the position of the cursor in other fields, before being removed. Change-Id: Ie81c1e394b06fef2ab801ccff919d6550f70ec30
This commit is contained in:
@@ -8,7 +8,8 @@ namespace Shared {
|
||||
namespace ToolboxHelpers {
|
||||
|
||||
int CursorIndexInCommandText(const char * text) {
|
||||
for (size_t i = 0; i < strlen(text); i++) {
|
||||
size_t textLength = strlen(text);
|
||||
for (size_t i = 0; i < textLength; i++) {
|
||||
if (text[i] == '(' || text[i] == '\'') {
|
||||
return i + 1;
|
||||
}
|
||||
@@ -16,7 +17,7 @@ int CursorIndexInCommandText(const char * text) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return strlen(text);
|
||||
return textLength;
|
||||
}
|
||||
|
||||
void TextToInsertForCommandMessage(I18n::Message message, char * buffer, int bufferSize, bool replaceArgsWithEmptyChar) {
|
||||
@@ -65,13 +66,5 @@ void TextToInsertForCommandText(const char * command, char * buffer, int bufferS
|
||||
buffer[currentNewTextIndex] = 0;
|
||||
}
|
||||
|
||||
void TextToParseIntoLayoutForCommandMessage(I18n::Message message, char * buffer, int bufferSize) {
|
||||
TextToParseIntoLayoutForCommandText(I18n::translate(message), buffer, bufferSize);
|
||||
}
|
||||
|
||||
void TextToParseIntoLayoutForCommandText(const char * command, char * buffer, int bufferSize) {
|
||||
TextToInsertForCommandText(command, buffer, bufferSize, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user