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

Method do

Lib/_pyrepl/readline.py:324–342  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

322
323class backspace_dedent(commands.Command):
324 def do(self) -> None:
325 r = self.reader
326 b = r.buffer
327 if r.pos > 0:
328 repeat = 1
329 if b[r.pos - 1] != "\n":
330 indent = _get_this_line_indent(b, r.pos)
331 if indent > 0:
332 ls = r.pos - indent
333 while ls > 0:
334 ls, pi = _get_previous_line_indent(b, ls - 1)
335 if pi is not None and pi < indent:
336 repeat = indent - pi
337 break
338 r.pos -= repeat
339 del b[r.pos : r.pos + repeat]
340 r.dirty = True
341 else:
342 self.reader.error("can't backspace at start")
343
344
345# ____________________________________________________________

Callers

nothing calls this directly

Calls 3

_get_this_line_indentFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected