1
0
This commit is contained in:
Deven Blake 2021-05-30 17:26:19 -04:00
parent b0db6717ca
commit 7626d24fad

20
it/dot.py Normal file
View File

@ -0,0 +1,20 @@
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