Find the right bracket enclosing current position. Return the relative
        position to the cursor position.

        When `end_pos` is given, don't look past the position.
339289
def find_enclosing_bracket_right(self, left_ch, right_ch, end_pos=None):
        
        if self.current_char == right_ch:
            return 0

        if end_pos is None:
            end_pos = len(self.text)
        else:
            end_pos = min(len(self.text), end_pos)

        stack = 1

        # Look forward.
        for i in range(self.cursor_position + 1, end_pos):
            c = self.text[i]

            if c == left_ch:
                stack += 1
            elif c == right_ch:
                stack -= 1

            if stack == 0:
                return i - self.cursor_position
1043904
def end_of_line(event):
    "  "
    buff = event.current_buffer
    buff.cursor_position += buff.document.get_end_of_line_position()
145549
def cursor_pos(self):
        """"""
        if len(self) == 0:
            return self.left + self.default_text.get_width()

        papy = self._surface.get_width()
        if papy > self.w:
            shift = papy - self.width
        else:
            shift = 0

        return self.left + self.font.size(self.shawn_text[:self.cursor])[0] - shift
256763
def has_match_at_current_position(self, sub):
        
        return self.text.find(sub, self.cursor_position) == self.cursor_position
930092
def end_coordsys(self):
        
        coordsys = copy(self.location)
        coordsys.origin = self.end_point
        return coordsys
1267239
function getCursorPosition(event) {
  let cursorX;
  let cursorY;
  let rect = htmlElement.getBoundingClientRect();
  if (event.touches !== undefined) {
    cursorX = event.touches[0].clientX;
    cursorY = event.touches[0].clientY;
  } else {
    cursorX = event.clientX;
    cursorY = event.clientY;
  }
  return {
    x: cursorX - rect.left,
    y: cursorY - rect.top,
  };
}
743742
def position(self, pos=None):
		
		if pos is not None:
			if pos >= len(self.__history):
				raise IndexError('History position is out of bound')
			self.__history_position = pos
		return self.__history_position
590228
def get_position(stream=STD_OUTPUT_HANDLE):
    '''  '''
    stream = kernel32.GetStdHandle(stream)
    csbi = CONSOLE_SCREEN_BUFFER_INFO()
    kernel32.GetConsoleScreenBufferInfo(stream, byref(csbi))

    pos = csbi.dwCursorPosition
    # zero based, add ones for compatibility.
    return (pos.X + 1, pos.Y + 1)
390329
def get_column_cursor_position(self, column):
        
        line_length = len(self.current_line)
        current_column = self.cursor_position_col
        column = max(0, min(line_length, column))

        return column - current_column
915576
def location(self, x=None, y=None):
        ''' 
        '''
        stream = self._stream
        stream.write(self.save_pos)  # cursor position

        if x is not None and y is not None:
            stream.write(self.mv(y, x))
        elif x is not None:
            stream.write(self.mv_x(x))
        elif y is not None:
            stream.write(self.mv_y(y))

        stream.flush()
        try:
            yield self
        finally:
            stream.write(self.rest_pos)
            stream.flush()
377991
def relevant_part(self, original, pos, sep=' '):
        
        start = original.rfind(sep, 0, pos) + 1
        end = original.find(sep, pos - 1)
        if end == -1:
            end = len(original)
        return original[start:end], start, end, pos - start
745369
def end_pos
      node_begin_pos = @node.loc.expression.begin_pos
      node_begin_pos += @node.loc.expression.source.index "do"
      while @node.loc.expression.source_buffer.source[node_begin_pos += 1] != '@'
      end
      node_begin_pos
    end
1290350
def get_position(self):
        
        with self._lock:
            return self.x, self.y, self.angle
486528
def _last_in_direction(starting_pos, direction):
        
        cur_pos = None
        next_pos = starting_pos
        while next_pos is not None:
            cur_pos = next_pos
            next_pos = direction(cur_pos)
        return cur_pos
1084547
def get_record_pos(self, record):
        
        if self.is_stopword_record(record):
            return '~' + record.pos
        else:
            return record.pos
873591
def prev_cursor_location(self):
        
        self._verify_entrypoint_selected()
        self.current_trace_frame_index = max(self.current_trace_frame_index - 1, 0)
        self.trace()
1354893
function getPosition(element) {
        var pos = {'left': 0, 'top': 0};
        do {
            pos.top += element.offsetTop || 0;
            pos.left += element.offsetLeft || 0;
            element = element.offsetParent;
        }
        while (element);
        return pos;
    }