MCPcopy Create free account
hub / github.com/bpython/bpython / delete_word_from_cursor_back

Function delete_word_from_cursor_back

bpython/curtsiesfrontend/manual_readline.py:357–372  ·  view source on GitHub ↗

Whatever my option-delete does in bash on my mac

(cursor_offset, line)

Source from the content-addressed store, hash-verified

355@edit_keys.on("<Meta-BACKSPACE>")
356@kills_behind
357def delete_word_from_cursor_back(cursor_offset, line):
358 """Whatever my option-delete does in bash on my mac"""
359 if not line:
360 return cursor_offset, line, ""
361 start = None
362 for match in delete_word_from_cursor_back_re.finditer(line):
363 if match.start() < cursor_offset:
364 start = match.start()
365 if start is not None:
366 return (
367 start,
368 line[:start] + line[cursor_offset:],
369 line[start:cursor_offset],
370 )
371 else:
372 return cursor_offset, line, ""

Callers

nothing calls this directly

Calls 2

finditerMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected