Adding proposed scrollback changes for sixel graphics ref. #30

This commit is contained in:
bakkeby 2021-07-07 09:43:43 +02:00
parent fb8d6e378c
commit 426eca8f2e
5 changed files with 69 additions and 22 deletions

View file

@ -14,6 +14,10 @@ kscrolldown(const Arg* a)
selscroll(0, -n);
tfulldirt();
}
#if SIXEL_PATCH
scroll_images(-1*n);
#endif // SIXEL_PATCH
}
void
@ -28,4 +32,8 @@ kscrollup(const Arg* a)
selscroll(0, n);
tfulldirt();
}
#if SIXEL_PATCH
scroll_images(n);
#endif // SIXEL_PATCH
}

View file

@ -15,4 +15,28 @@ dcshandle(void)
term.mode |= MODE_SIXEL;
break;
}
}
void
scroll_images(int n) {
ImageList *im;
int tmp;
/* maximum sixel distance in lines from current view before
* deallocation
* TODO: should be in config.h */
int max_sixel_distance = 10000;
for (im = term.images; im; im = im->next) {
im->y += n;
/* check if the current sixel has exceeded the maximum
* draw distance, and should therefore be deleted */
tmp = im->y;
if (tmp < 0) { tmp = tmp * -1; }
if (tmp > max_sixel_distance) {
fprintf(stderr, "im@0x%08x exceeded maximum distance\n");
im->should_delete = 1;
}
}
}

View file

@ -1 +1,2 @@
static void dcshandle(void);
static void dcshandle(void);
static void scroll_images(int n);