From b96038db130b9be1b2544366df4876b087af2fdd Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Thu, 3 Jun 2021 18:29:32 -0400 Subject: [PATCH] potentially works --- it/src/i.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/it/src/i.py b/it/src/i.py index 1fe385c..89ab7c0 100644 --- a/it/src/i.py +++ b/it/src/i.py @@ -3,10 +3,10 @@ def main(buffer, command): print("?") return buffer - i = "" - while len(i) < 1 or i[-1] != ".\n": + i = [] + while True: try: - i += input() + "\n" + line = input() # unintuitive behavior from ed except KeyboardInterrupt: print("?") @@ -14,9 +14,18 @@ def main(buffer, command): except EOFError: break + if line == ".": + break + + i.append(line) + if buffer.dot < buffer.index: - buffer.content = i + buffer.content_set_list(i) else: - buffer.content = - buffer.dot += i.count("\n") + buffer.content_set_list( + buffer.content_list()[:buffer.dot] + + i + + buffer.content_list()[buffer.dot:] + ) + buffer.dot += len(i) return buffer