From 7626d24fad49097da8f3ae5a8576233921c4eeec Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Sun, 30 May 2021 17:26:19 -0400 Subject: [PATCH] WIP --- it/dot.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 it/dot.py 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