[escher] XNT button is now cyclic

This commit is contained in:
Laury
2022-07-06 22:52:49 +02:00
parent 77167d1706
commit 51a5f699c3
30 changed files with 167 additions and 48 deletions

View File

@@ -1,20 +1,24 @@
#include "helpers.h"
#include <escher/clipboard.h>
#include <apps/apps_container.h>
namespace Code {
namespace Helpers {
const char * PythonTextForEvent(Ion::Events::Event event) {
bool PythonTextForEvent(Ion::Events::Event event, char * buffer, bool * shouldRemoveLastCharacter) {
for (size_t i=0; i<NumberOfPythonTextPairs; i++) {
UTF8Helper::TextPair pair = PythonTextPairs[i];
if (event.text() == pair.firstString()) {
return pair.secondString();
strcpy(buffer, pair.secondString());
return true;
}
if (event == Ion::Events::XNT) {
return "x";
CodePoint XNT = AppsContainer::sharedAppsContainer()->XNT('x', shouldRemoveLastCharacter);
buffer[UTF8Decoder::CodePointToChars(XNT, buffer, CodePoint::MaxCodePointCharLength + 1)] = 0;
return true;
}
return false;
}
return nullptr;
}
}
}