[vte/wip/sixels: 56/111] sixels: test: Factor out print_random_text()




commit 6ea32e9a23eb8b17c75e757c30235473f37808b0
Author: Hans Petter Jansson <hpj cl no>
Date:   Sat Aug 8 20:42:49 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]