MCPcopy Index your code
hub / github.com/python/cpython / get_selection

Function get_selection

Lib/idlelib/searchengine.py:212–224  ·  view source on GitHub ↗

Return tuple of 'line.col' indexes from selection or insert mark.

(text)

Source from the content-addressed store, hash-verified

210 return found
211
212def get_selection(text):
213 '''Return tuple of 'line.col' indexes from selection or insert mark.
214 '''
215 try:
216 first = text.index("sel.first")
217 last = text.index("sel.last")
218 except TclError:
219 first = last = None
220 if not first:
221 first = text.index("insert")
222 if not last:
223 last = first
224 return first, last
225
226def get_line_col(index):
227 '''Return (line, col) tuple of ints from 'line.col' string.'''

Callers 1

search_textMethod · 0.85

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…