2025-12-21 10:48:40 +02:00
|
|
|
# deck.input: Standard input abstraction library for max compatibility
|
2025-12-21 10:49:26 +02:00
|
|
|
# Usage: from deck.input import input, input_multi
|
2025-12-21 10:48:40 +02:00
|
|
|
# Created by Luxferre in 2025, released into public domain
|
|
|
|
|
|
|
|
|
|
# init the tdeck_repl input where applicable
|
|
|
|
|
try:
|
2025-12-22 16:49:57 +02:00
|
|
|
from repl.tdeck_repl import input
|
2025-12-21 10:48:40 +02:00
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
input = input # reexport the standard Python input method
|
|
|
|
|
|
|
|
|
|
def input_multi(prompt=None, terminator='.'):
|
|
|
|
|
"""Multiline input method (ed-like)"""
|
|
|
|
|
buf = []
|
|
|
|
|
if prompt is not None:
|
|
|
|
|
print(prompt, end='')
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
|
s = input()
|
|
|
|
|
if s == terminator: break
|
|
|
|
|
else: buf.append(s)
|
|
|
|
|
except (KeyboardInterrupt, EOFError):
|
|
|
|
|
print()
|
|
|
|
|
break
|
|
|
|
|
return '\n'.join(buf)
|
|
|
|
|
|