If I run my program dash2ink.py
#!/usr/bin/env python3
s = input('Enter a long line please: ')
print('len(s) =', len(s))
print('end of s =', repr(s[-100:]))
and enter/paste a very long line, the length reported doesn't match the input length - the end is cut off to a length of 4095 characters.
Searching the web got me onto this answer on unix.stackexchange.com which (for my question) boils down to
4095 is the limit of the tty line discipline internal editor length on Linux
which seems to be used by the input
function.
As suggested by the answer, I was able to get the whole entered/pasted string if I ran run my program like so:
saved=$(stty -g); stty -icanon icrnl; ./dash2ink.py ; stty "$saved"
Is there a way so I can simply run ./dash2ink.py
and still have a relaxed input
length limit?