Rederives the offset from the cursor string.
544383
public static function cursorToOffset($cursor)
    {
        $offset = substr(base64_decode($cursor), strlen(self::PREFIX));
        if (is_numeric($offset)){
            return intval($offset);
        } else {
            return null;
        }
    }
950785
def _cursor_up(self, value):
        
        value = int(value)
        if value == 0:
            value = 1
        self._cursor.clearSelection()
        self._cursor.movePosition(self._cursor.Up, self._cursor.MoveAnchor, value)
        self._last_cursor_pos = self._cursor.position()
308906
def reverseCommit(self):
        

        # Loop over all lines in the rectangle to remove the
        # previously yanked strings.
        col = self.cursorPos[1]
        for ii, text in enumerate(self.insertedText):
            line = ii + self.cursorPos[0]

            # Select as many characters as the string is long and remove
            # them.
            self.qteWidget.setSelection(line, col, line, col + len(text))
            self.baseClass.removeSelectedText()

        # Place the cursor at the original position.
        self.qteWidget.setCursorPosition(*self.cursorPos)
1070524
private function recordOffset($arr)
    {
        list($this->int_offset, $this->str_start_cursor) = $this->getIntStringFromValue($this->lookupToken($arr['offset']));
        return '';
    }
1361332
def apply_offset(self):
    ''''''
    self._ensure_modification_is_safe()

    if self.query.offset != 0:
      self._iterable = \
        offset_gen(self.query.offset, self._iterable, self._skipped_inc)
1131482
public R setOffset(int offset) {
        mQueryMap.put(OFFSET, String.valueOf(offset));
        return (R) this;
    }
1268789
def __restore_selection(self, start_pos, end_pos):
        """"""
        cursor = self.textCursor()
        cursor.setPosition(start_pos)
        cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)
851453
public void moveCursorLine (int line) {
		if (line < 0) {
			cursorLine = 0;
			cursor = 0;
			moveOffset = -1;
		} else if (line >= getLines()) {
			int newLine = getLines() - 1;
			cursor = text.length();
			if (line > getLines() || newLine == cursorLine) {
				moveOffset = -1;
			}
			cursorLine = newLine;
		} else if (line != cursorLine) {
			if (moveOffset < 0) {
				moveOffset = linesBreak.size <= cursorLine * 2 ? 0
						: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.get(cursorLine * 2));
			}
			cursorLine = line;
			cursor = cursorLine * 2 >= linesBreak.size ? text.length() : linesBreak.get(cursorLine * 2);
			while (cursor < text.length() && cursor <= linesBreak.get(cursorLine * 2 + 1) - 1
					&& glyphPositions.get(cursor) - glyphPositions.get(linesBreak.get(cursorLine * 2)) < moveOffset) {
				cursor++;
			}
			showCursor();
		}
	}
482499
def offset(self):
        
        try:
            return Offset(self._annotations[EventData.PROP_OFFSET].decode('UTF-8'))
        except (KeyError, AttributeError):
            return None
501690
def _set_cursor_position(self, value):
        
        original_position = self.__cursor_position
        self.__cursor_position = max(0, value)

        return value != original_position
1303406
function positionToOffset(str, desiredLine, desiredCol) {
    if (desiredLine === 1) {
        return desiredCol - 1;
    }
    let line = 1;
    let lastNewLineOffset = -1;
    do {
        if (desiredLine === line) {
            return lastNewLineOffset + 1 + desiredCol - 1;
        }
        lastNewLineOffset = str.indexOf('\n', lastNewLineOffset + 1);
        line++;
    } while (lastNewLineOffset >= 0);
    return -1;
}
571763
def offset(self, offset):
        """"""
        clone = self._clone()

        if isinstance(offset, int):
            clone._offset = offset

        return clone
995211
def _update_offsets(start_x, spacing, terminations, offsets, length):
    '''
    '''
    return (start_x + spacing[0] * terminations / 2.,
            offsets[1] + spacing[1] * 2. + length)
252788
def horz_offset(self, offset):
        
        self.get_or_add_xMode().val = ST_LayoutMode.FACTOR
        self.get_or_add_x().val = offset
559642
def move(self, x, y):
        
        self._cursor = self._normalizePoint(x, y)
976186
def offset(self, value):
        

        self._query = self._query.skip(value)

        return self
851633
def line_to_offset(self, line, column):
    
    line -= 1
    if line >= len(self._line_offsets):
      return self._text_len
    elif line < 0:
      return 0
    else:
      return min(self._line_offsets[line] + max(0, column), self._text_len)