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

Class up

Lib/_pyrepl/commands.py:249–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 5

demo1Function · 0.50
mainFunction · 0.50
yinFunction · 0.50
switchupdownFunction · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected