(self)
| 322 | |
| 323 | class 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 | # ____________________________________________________________ |
nothing calls this directly
no test coverage detected