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

Method do

Lib/_pyrepl/commands.py:280–308  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

278
279class down(MotionCommand):
280 def do(self) -> None:
281 r = self.reader
282 b = r.buffer
283 for _ in range(r.get_arg()):
284 x, y = r.pos2xy()
285 new_y = y + 1
286
287 if r.eol() == len(b):
288 if r.historyi < len(r.history):
289 r.select_item(r.historyi + 1)
290 r.pos = r.eol(0)
291 return
292 r.pos = len(b)
293 r.error("end of buffer")
294 return
295
296 if (
297 x
298 > (
299 new_x := r.max_column(new_y)
300 ) # we're past the end of the previous line
301 or x == r.max_column(y)
302 and any(
303 not i.isspace() for i in r.buffer[r.bol() :]
304 ) # move between eols
305 ):
306 x = new_x
307
308 r.setpos_from_xy(x, new_y)
309
310
311class left(MotionCommand):

Callers

nothing calls this directly

Calls 10

get_argMethod · 0.80
pos2xyMethod · 0.80
eolMethod · 0.80
max_columnMethod · 0.80
isspaceMethod · 0.80
bolMethod · 0.80
setpos_from_xyMethod · 0.80
anyFunction · 0.50
select_itemMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected