diff --git a/it/dot.py b/it/dot.py new file mode 100644 index 0000000..c45fe1a --- /dev/null +++ b/it/dot.py @@ -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