diff --git a/coder.py b/coder.py index d1b868509..c8ff1801b 100755 --- a/coder.py +++ b/coder.py @@ -141,18 +141,29 @@ class Coder: print() inp = "" + multiline_input = False if self.pretty: print(Fore.GREEN, end="\r") else: print() - while not inp.strip(): + while True: try: - inp = input("> ") + line = input("> ") except EOFError: return - ### + if line.strip() == "{" and not multiline_input: + multiline_input = True + continue + elif line.strip() == "}" and multiline_input: + break + elif multiline_input: + inp += line + "\n" + else: + inp = line + break + if self.pretty: print(Style.RESET_ALL) else: @@ -160,7 +171,6 @@ class Coder: readline.write_history_file(history_file) return inp - def check_for_local_edits(self, init=False): last_modified = max(Path(fname).stat().st_mtime for fname in self.fnames) since = last_modified - self.last_modified @@ -609,4 +619,4 @@ def main(): if __name__ == "__main__": status = main() - sys.exit(status) + sys.exit(status) \ No newline at end of file