MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuCodeSelect

Function PiuCodeSelect

modules/piu/PC/Code/piuCode.c:718–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718void PiuCodeSelect(PiuCode* self, int32_t selectionOffset, uint32_t selectionLength)
719{
720 xsMachine* the = (*self)->the;
721 xsStringValue string = PiuToString((*self)->string);
722 int32_t from = selectionOffset;
723 int32_t to = selectionOffset + selectionLength;
724 int32_t offset;
725 if (from < 0)
726 from = 0;
727 else if (from > (int32_t)(*self)->length)
728 from = (*self)->length;
729 if (to < 0)
730 to = 0;
731 else if (to > (int32_t)(*self)->length)
732 to = (*self)->length;
733 (*self)->from = from;
734 (*self)->to = to;
735 offset = fxUnicodeToUTF8Offset(string, from);
736 PiuCodeOffsetToColumnLine(self, offset, &(*self)->fromColumn, &(*self)->fromLine);
737 if (to == from) {
738 (*self)->toColumn = (*self)->fromColumn;
739 (*self)->toLine = (*self)->fromLine;
740 }
741 else {
742 offset = fxUnicodeToUTF8Offset(string, (*self)->to);
743 PiuCodeOffsetToColumnLine(self, offset, &(*self)->toColumn, &(*self)->toLine);
744 }
745 PiuCodeInvalidate(self, NULL);
746}
747
748void PiuCodeUnbind(void* it, PiuApplication* application, PiuView* view)
749{

Callers 5

PiuCodeDictionaryFunction · 0.85
PiuCode_set_stringFunction · 0.85
PiuCode_findFunction · 0.85
PiuCode_findAgainFunction · 0.85
PiuCode_selectFunction · 0.85

Calls 3

fxUnicodeToUTF8OffsetFunction · 0.85
PiuCodeInvalidateFunction · 0.85

Tested by

no test coverage detected