aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-30 19:37:51 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-30 19:37:51 +0000
commit77f6c126f55985d17affc04b8552750112ce4f86 (patch)
tree48a12d6a4243f3b0d3af1312198a3503108eb0bf /scripts
parentinput: take scale into account when converting mouse coords to row/col (diff)
generate-alt-random-writes: generate streaks of characters
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate-alt-random-writes.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/generate-alt-random-writes.py b/scripts/generate-alt-random-writes.py
index f066485e..7fa040fa 100755
--- a/scripts/generate-alt-random-writes.py
+++ b/scripts/generate-alt-random-writes.py
@@ -63,6 +63,9 @@ def main():
col = rand.read(1)[0] % cols
c = alphabet[rand.read(1)[0] % len(alphabet)]
+ repeat = rand.read(1)[0] % (cols - col) + 1
+ assert col + repeat <= cols
+
color_variant = color_variants[rand.read(1)[0] % len(color_variants)]
# Position cursor
@@ -81,7 +84,7 @@ def main():
rgb = rand.read(3)
out.write(f'\033[{48 if do_bg else 38}:2::{rgb[0]}:{rgb[1]}:{rgb[2]}m')
- out.write(c)
+ out.write(c * repeat)
if color_variant != ColorVariant.NONE:
do_sgr_reset = rand.read(1)[0] % 2