MCPcopy Index your code
hub / github.com/RustPython/RustPython / do

Method do

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

Source from the content-addressed store, hash-verified

246
247class up(MotionCommand):
248 def do(self) -> None:
249 r = self.reader
250 for _ in range(r.get_arg()):
251 x, y = r.pos2xy()
252 new_y = y - 1
253
254 if r.bol() == 0:
255 if r.historyi > 0:
256 r.select_item(r.historyi - 1)
257 return
258 r.pos = 0
259 r.error("start of buffer")
260 return
261
262 if (
263 x
264 > (
265 new_x := r.max_column(new_y)
266 ) # we're past the end of the previous line
267 or x == r.max_column(y)
268 and any(
269 not i.isspace() for i in r.buffer[r.bol() :]
270 ) # move between eols
271 ):
272 x = new_x
273
274 r.setpos_from_xy(x, new_y)
275
276
277class down(MotionCommand):

Callers 1

do_cmdMethod · 0.45

Calls 9

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

Tested by

no test coverage detected