From 5b7fa586a081dac862a27cda3e774a7153a709e2 Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Sun, 30 May 2021 17:17:11 -0400 Subject: [PATCH] forcefully mark buffer as saved/unsaved --- it/saved.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 it/saved.py diff --git a/it/saved.py b/it/saved.py new file mode 100644 index 0000000..47f12d6 --- /dev/null +++ b/it/saved.py @@ -0,0 +1,15 @@ +def main(buffer, command): + if len(command) > 2: + print("?") + elif len(command) == 2: + if command[1].isdigit(): + buffer.saved = int(command[1]) + elif command[1].lower() in {"true","false"}: + buffer.saved = command[1].lower == "true" + else: + print("?") + else: + buffer.saved = not(buffer.saved) + print("Buffer marked as %sSAVED" % ("" if buffer.saved else "NOT ")) + + return buffer