commit 3aa50c8bd13ffa4209733ac54b5d5154676bc51e
Author: Hans Petter Jansson <hpj cl no>
Date: Fri Jun 12 00:43:55 2020 +0200
sixels: test: Factor out print_random_text()
src/sixel-gen.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/sixel-gen.cc b/src/sixel-gen.cc
index 752006ff..b9cd5e3c 100644
--- a/src/sixel-gen.cc
+++ b/src/sixel-gen.cc
@@ -439,6 +439,15 @@ print_random_image (const Options *options, GString *gstr)
image_deinit (&image);
}
+static void
+print_random_text (const Options *options, GString *gstr)
+{
+ cursor_to_random_offset (options->term_width_cells - strlen ("Hallo!"),
+ options->term_height_cells,
+ gstr);
+ print_text ("Hallo!", gstr);
+}
+
static void
print_loop (const Options *options)
{
@@ -452,10 +461,7 @@ print_loop (const Options *options)
if (random () % 2) {
print_random_image (options, gstr);
} else {
- cursor_to_random_offset (options->term_width_cells - strlen ("Hallo!"),
- options->term_height_cells,
- gstr);
- print_text ("Hallo!", gstr);
+ print_random_text (options, gstr);
}
fwrite (gstr->str, sizeof (char), gstr->len, stdout);