1
0
Fork 0
src/Wip/it/dot.py

21 lines
594 B
Python

def main(buffer, command):
if len(command) == 2 and (command[1].isdigit() or command[1] in {"^","$"}):
if command[1].isdigit():
dot = int(command[1])
elif command[1] == "^":
dot = buffer.carat()
elif command[1] == "$":
dot = buffer.dollar()
elif len(command) == 3 and command[1] in {"+","-"} and command[2].isdigit():
if command[1] == "+":
dot = buffer.dot + int(command[2])
elif command[1] == "-":
dot = buffer.dot - int(command[2])
if not("dot" in locals()) or dot < buffer.carat() or dot > buffer.dollar():
print("?")
else:
buffer.dot = dot
return buffer