aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-10-04 17:28:22 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-10-11 17:25:56 +0000
commiteec097173979d198042447739a687891ebae1ac6 (patch)
treed33d3af09d5d91f5de140c3f31a482c6af3df52b
parentsixel: cell-size-changed: don’t verify sixels here (diff)
sixel: scroll up/down: early return when list is empty
Branch tagged as ‘likely’ for performance reason
-rw-r--r--sixel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sixel.c b/sixel.c
index ee34df0a..76b42b25 100644
--- a/sixel.c
+++ b/sixel.c
@@ -242,6 +242,9 @@ out:
void
sixel_scroll_up(struct terminal *term, int rows)
{
+ if (likely(tll_length(term->grid->sixel_images) == 0))
+ return;
+
tll_rforeach(term->grid->sixel_images, it) {
struct sixel *six = &it->item;
@@ -269,6 +272,9 @@ sixel_scroll_up(struct terminal *term, int rows)
void
sixel_scroll_down(struct terminal *term, int rows)
{
+ if (likely(tll_length(term->grid->sixel_images) == 0))
+ return;
+
assert(term->grid->num_rows >= rows);
tll_foreach(term->grid->sixel_images, it) {