void CharsetWidget::updateCharIndex(int charIndex)
{
    if (_charIndex != charIndex && charIndex >=0 && charIndex < 256)
    {
        _charIndex = charIndex;
        auto state = State::getInstance();
        state->setCharIndex(charIndex);
    }
}
void ZLTextWordCursor::moveTo(int elementIndex, int charIndex) {
	if (!isNull()) {
		if ((elementIndex == 0) && (charIndex == 0)) {
			myElementIndex = 0;
			myCharIndex = 0;
		} else {
			elementIndex = std::max(0, elementIndex);
			size_t size = myParagraphCursor->paragraphLength();
			if ((size_t)elementIndex > size) {
				myElementIndex = size;
				myCharIndex = 0;
			} else {
				myElementIndex = elementIndex;
				setCharIndex(charIndex);
			}
		}
	}
}