Return current word, i.e. word at cursor position
765836
def get_current_word(self, completion=False):
        """"""
        ret = self.get_current_word_and_position(completion)
        if ret is not None:
            return ret[0]
85142
def get_dword_from_offset(self, offset):
        """"""

        if offset+4 > len(self.__data__):
            return None

        return self.get_dword_from_data(self.__data__[offset:offset+4], 0)
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
257836
def set_word_at_offset(self, offset, word):
        """"""
        return self.set_bytes_at_offset(offset, self.get_data_from_word(word))
220739
def select_current_cell(self):
        """"""
        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.StartOfBlock)
        cur_pos = prev_pos = cursor.position()

        # Moving to the next line that is not a separator, if we are
        # exactly at one of them
        while self.is_cell_separator(cursor):
            cursor.movePosition(QTextCursor.NextBlock)
            prev_pos = cur_pos
            cur_pos = cursor.position()
            if cur_pos == prev_pos:
                return cursor, False
        prev_pos = cur_pos
        # If not, move backwards to find the previous separator
        while not self.is_cell_separator(cursor):
            cursor.movePosition(QTextCursor.PreviousBlock)
            prev_pos = cur_pos
            cur_pos = cursor.position()
            if cur_pos == prev_pos:
                if self.is_cell_separator(cursor):
                    return cursor, False
                else:
                    break
        cursor.setPosition(prev_pos)
        cell_at_file_start = cursor.atStart()
        # Once we find it (or reach the beginning of the file)
        # move to the next separator (or the end of the file)
        # so we can grab the cell contents
        while not self.is_cell_separator(cursor):
            cursor.movePosition(QTextCursor.NextBlock,
                                QTextCursor.KeepAnchor)
            cur_pos = cursor.position()
            if cur_pos == prev_pos:
                cursor.movePosition(QTextCursor.EndOfBlock,
                                    QTextCursor.KeepAnchor)
                break
            prev_pos = cur_pos
        cell_at_file_end = cursor.atEnd()
        return cursor, cell_at_file_start and cell_at_file_end
518621
def find(str)
      index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}
      move_cursor index if index
    end
896410
def cursor_position_changed(self):
        """"""
        log.debug("cursor_position_changed")

        cur = self.textCursor()
        log.debug(cur.position())
        log.debug(cur.selectedText())
        if len(cur.selectedText()) == 0:
            cur.select(QtGui.QTextCursor.WordUnderCursor)
            self.setTextCursor(cur)
1007138
def cursor(self, as_dict=False):
        """"""
        self.ensure_connect()
        ctype = self.real_ctype(as_dict)
        return self._connect.cursor(ctype)
1214159
def move_cursor_one_word(self, word=LEFT):
        """"""

        assert word in (self.RIGHT, self.LEFT)

        if word == self.RIGHT:
            papy = self.text.find(' ', self.cursor) + 1
            if not papy:
                papy = len(self)
            self.cursor = papy
        else:
            papy = self.text.rfind(' ', 0, self.cursor)
            if papy == -1:
                papy = 0
            self.cursor = papy
659144
def select(self, cursor, qstring, vals=()):
    ""
    cursor.execute(qstring, vals) # hmm; do I not want to commit at the end of this?
    return cursor.fetchall()
846020
function cursorInit() {
	scrolled = bw.ns4 || bw.ns5 ? "window.pageYOffset" : "document.body.scrollTop"
	if (bw.ns4) document.captureEvents(Event.MOUSEMOVE)
}
1107863
def get_partial_word_under_cursor(self):
        

        if not re.match(r"^\w+$", foundations.strings.to_string(self.get_previous_character())):
            return QString()

        cursor = self.textCursor()
        position = cursor.position()
        cursor.movePosition(QTextCursor.PreviousWord, QTextCursor.KeepAnchor)
        return cursor.selectedText()
1263552
def word_under_cursor line=text(), pos=@curpos, delim=" "
      line ||= text()
      pos ||= @curpos
      # if pressed on a space, try to go to next word to make easier 2013-03-24
      if line[pos,1] == delim
        while line[pos,1] == delim
          pos += 1
        end
      end
      finish = line.index(delim, pos)
      start = line.rindex(delim,pos)
      finish = -1 if finish.nil?
      start = 0 if start.nil?
      return line[start..finish]
    end
262790
def find_previous_word_ending(self, count=1, WORD=False):
        
        if count < 0:
            return self.find_next_word_ending(count=-count, WORD=WORD)

        text_before_cursor = self.text_after_cursor[:1] + self.text_before_cursor[::-1]

        regex = _FIND_BIG_WORD_RE if WORD else _FIND_WORD_RE
        iterator = regex.finditer(text_before_cursor)

        try:
            for i, match in enumerate(iterator):
                # Take first match, unless it's the word on which we're right now.
                if i == 0 and match.start(1) == 0:
                    count += 1

                if i + 1 == count:
                    return -match.start(1) + 1
        except StopIteration:
            pass
66718
function currentYPosition() {
	// Firefox, Chrome, Opera, Safari
	if (self.pageYOffset) return self.pageYOffset;
	// Internet Explorer 6 - standards mode
	if (document.documentElement && document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
	// Internet Explorer 6, 7 and 8
	if (document.body.scrollTop) return document.body.scrollTop;
	return 0;
}
682086
def lf (self):
        '''
        '''

        old_r = self.cur_r
        self.cursor_down()
        if old_r == self.cur_r:
            self.scroll_up ()
            self.erase_line()
1094404
def get_cursor_position(self):
        """"""
        # TODO would this be cleaner as a parameter?
        in_stream = self.in_stream

        query_cursor_position = u"\x1b[6n"
        self.write(query_cursor_position)

        def retrying_read():
            while True:
                try:
                    c = in_stream.read(1)
                    if c == '':
                        raise ValueError("Stream should be blocking - should't"
                                         " return ''. Returned %r so far",
                                         (resp,))
                    return c
                except IOError:
                    raise ValueError(
                        'cursor get pos response read interrupted'
                    )
                    # find out if this ever really happens - if so, continue

        resp = ''
        while True:
            c = retrying_read()
            resp += c
            m = re.search('(?P<extra>.*)'
                          '(?P<CSI>\x1b\[|\x9b)'
                          '(?P<row>\\d+);(?P<column>\\d+)R', resp, re.DOTALL)
            if m:
                row = int(m.groupdict()['row'])
                col = int(m.groupdict()['column'])
                extra = m.groupdict()['extra']
                if extra:
                    if self.extra_bytes_callback:
                        self.extra_bytes_callback(
                            extra.encode(in_stream.encoding)
                        )
                    else:
                        raise ValueError(("Bytes preceding cursor position "
                                          "query response thrown out:\n%r\n"
                                          "Pass an extra_bytes_callback to "
                                          "CursorAwareWindow to prevent this")
                                         % (extra,))
                return (row - 1, col - 1)