scripts: generate-alt-random-writes: mix \e[S with \n

This commit is contained in:
Daniel Eklöf 2020-11-16 20:01:58 +01:00
parent e1bde0b0e7
commit 1e1fb157dc
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -69,7 +69,11 @@ def main():
lines_to_scroll = rand.read(1)[0] % (lines - 1)
rev = rand.read(1)[0] % 2
out.write(f'\033[{lines_to_scroll + 1}{"T" if rev == 1 else "S"}')
if not rev and rand.read(1)[0] % 2:
out.write(f'\033[{lines};{cols}H')
out.write('\n' * lines_to_scroll)
else:
out.write(f'\033[{lines_to_scroll + 1}{"T" if rev == 1 else "S"}')
continue
# Generate a random location and a random character