MCPcopy Create free account
hub / github.com/python/cpython / getprevword

Method getprevword

Lib/idlelib/autoexpand.py:85–91  ·  view source on GitHub ↗

Return the word prefix before the cursor.

(self)

Source from the content-addressed store, hash-verified

83 return words
84
85 def getprevword(self):
86 "Return the word prefix before the cursor."
87 line = self.text.get("insert linestart", "insert")
88 i = len(line)
89 while i > 0 and line[i-1] in self.wordchars:
90 i = i-1
91 return line[i:]
92
93
94if __name__ == '__main__':

Callers 2

expand_word_eventMethod · 0.95
getwordsMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected