From b0db6717ca103c9226b4d6c76a83e11cc6566c24 Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Sun, 30 May 2021 17:26:03 -0400 Subject: [PATCH] works in progress --- it/i.py | 22 ++++++++++++++++++++++ it/p.py | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 it/i.py create mode 100644 it/p.py diff --git a/it/i.py b/it/i.py new file mode 100644 index 0000000..1fe385c --- /dev/null +++ b/it/i.py @@ -0,0 +1,22 @@ +def main(buffer, command): + if len(command) > 1: + print("?") + return buffer + + i = "" + while len(i) < 1 or i[-1] != ".\n": + try: + i += input() + "\n" + # unintuitive behavior from ed + except KeyboardInterrupt: + print("?") + return buffer + except EOFError: + break + + if buffer.dot < buffer.index: + buffer.content = i + else: + buffer.content = + buffer.dot += i.count("\n") + return buffer diff --git a/it/p.py b/it/p.py new file mode 100644 index 0000000..34a6a21 --- /dev/null +++ b/it/p.py @@ -0,0 +1,7 @@ +def main(buffer, command): + if len(command) < 1 or len(command) > 2: + + if buffer.dot < buffer.index: + buffer.content = i + buffer.dot += len(i) + return buffer