| 247 | |
| 248 | |
| 249 | class 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 | |
| 279 | class down(MotionCommand): |
no outgoing calls
no test coverage detected