fix a few bugs in sixel
This commit is contained in:
parent
5ad0db7949
commit
186cf03d68
8
Makefile
8
Makefile
|
@ -32,12 +32,12 @@ clean:
|
||||||
rm -f st $(OBJ) st-$(VERSION).tar.gz
|
rm -f st $(OBJ) st-$(VERSION).tar.gz
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p st-$(VERSION)
|
mkdir -p st-spde-$(VERSION)
|
||||||
cp -R LICENSE Makefile *.mk \
|
cp -R LICENSE Makefile *.mk \
|
||||||
*.h *.info *.c *.desktop *.png docs/ scripts/ \
|
*.h *.info *.c *.desktop *.png docs/ scripts/ \
|
||||||
st-$(VERSION)
|
st-spde-$(VERSION)
|
||||||
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
tar -cf - st-spde-$(VERSION) | gzip > st-spde-$(VERSION).tar.gz
|
||||||
rm -rf st-$(VERSION)
|
rm -rf st-spde-$(VERSION)
|
||||||
|
|
||||||
install: st
|
install: st
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
|
|
|
@ -27,6 +27,8 @@ static Shortcut shortcuts[] = {
|
||||||
{ CONTROL|SHIFT, XK_H, kexec, {.scmd = "st_help" } },
|
{ CONTROL|SHIFT, XK_H, kexec, {.scmd = "st_help" } },
|
||||||
{ CONTROL|SHIFT, XK_E, kexec, {.scmd = "$EDITOR" } },
|
{ CONTROL|SHIFT, XK_E, kexec, {.scmd = "$EDITOR" } },
|
||||||
{ CONTROL|SHIFT, XK_D, kexec, {.scmd = "$PERM !!" } },
|
{ CONTROL|SHIFT, XK_D, kexec, {.scmd = "$PERM !!" } },
|
||||||
|
{ CONTROL|SHIFT, XK_F, kexec, {.scmd = "$EDITOR $(find ~/.config -type f | fzf)" } },
|
||||||
|
{ CONTROL|SHIFT, XK_S, kexec, {.scmd = "$EDITOR $(find ~/Scripts -type f | fzf)" } },
|
||||||
{ CONTROL|SHIFT, XK_K, kscrollup, {.i = -1} },
|
{ CONTROL|SHIFT, XK_K, kscrollup, {.i = -1} },
|
||||||
{ CONTROL|SHIFT, XK_J, kscrolldown, {.i = -1} },
|
{ CONTROL|SHIFT, XK_J, kscrolldown, {.i = -1} },
|
||||||
{ CONTROL|SHIFT, XK_U, externalpipeout,{.v = listurl } },
|
{ CONTROL|SHIFT, XK_U, externalpipeout,{.v = listurl } },
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "This is a test of the st help keybind!"
|
echo "This is a test of the st help keybind!"
|
||||||
|
|
56
st.c
56
st.c
|
@ -180,6 +180,7 @@ static void ttywriteraw(const char *, size_t);
|
||||||
|
|
||||||
static void csidump(void);
|
static void csidump(void);
|
||||||
static void dcshandle(void);
|
static void dcshandle(void);
|
||||||
|
static void scroll_images(int n);
|
||||||
static void csihandle(void);
|
static void csihandle(void);
|
||||||
static void readcolonargs(char **, int, int[][CAR_PER_ARG]);
|
static void readcolonargs(char **, int, int[][CAR_PER_ARG]);
|
||||||
static void csiparse(void);
|
static void csiparse(void);
|
||||||
|
@ -1218,10 +1219,7 @@ kscrolldown(const Arg* a)
|
||||||
tfulldirt();
|
tfulldirt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Implement proper scrollback support
|
scroll_images(-1*n);
|
||||||
* For now, this will do */
|
|
||||||
for (im = term.sixel.images; im; im = im->next)
|
|
||||||
im->should_delete = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1245,10 +1243,14 @@ kscrollup(const Arg* a)
|
||||||
tfulldirt();
|
tfulldirt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Implement proper scrollback support
|
if (term.scr + n > term.histi)
|
||||||
* For now, this will do */
|
n = term.histi - term.scr;
|
||||||
for (im = term.sixel.images; im; im = im->next)
|
|
||||||
im->should_delete = 1;
|
if (!n)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
scroll_images(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1276,17 +1278,37 @@ tscrolldown(int orig, int n, int copyhist)
|
||||||
term.line[i-n] = temp;
|
term.line[i-n] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scroll_images(n);
|
||||||
|
|
||||||
if (term.scr == 0)
|
if (term.scr == 0)
|
||||||
selscroll(orig, n);
|
selscroll(orig, n);
|
||||||
|
|
||||||
/* TODO: Implement proper scrollback support
|
|
||||||
* For now, this will do */
|
|
||||||
for (im = term.sixel.images; im; im = im->next)
|
|
||||||
im->should_delete = 1;
|
|
||||||
|
|
||||||
/* process scrolldown */
|
/* process scrolldown */
|
||||||
xsixelscrolldown(&term.sixel, n, term.bot);
|
xsixelscrolldown(&term.sixel, n, term.bot);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.sixel.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1294,7 +1316,6 @@ tscrollup(int orig, int n, int copyhist)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Line temp;
|
Line temp;
|
||||||
ImageList *im;
|
|
||||||
|
|
||||||
LIMIT(n, 0, term.bot-orig+1);
|
LIMIT(n, 0, term.bot-orig+1);
|
||||||
|
|
||||||
|
@ -1317,6 +1338,8 @@ tscrollup(int orig, int n, int copyhist)
|
||||||
term.line[i+n] = temp;
|
term.line[i+n] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scroll_images(-1*n);
|
||||||
|
|
||||||
/* process scrollup */
|
/* process scrollup */
|
||||||
xsixelscrollup(&term.sixel, n, term.top);
|
xsixelscrollup(&term.sixel, n, term.top);
|
||||||
|
|
||||||
|
@ -1894,6 +1917,7 @@ csihandle(void)
|
||||||
{
|
{
|
||||||
char buf[40];
|
char buf[40];
|
||||||
int len;
|
int len;
|
||||||
|
ImageList *im;
|
||||||
|
|
||||||
switch (csiescseq.mode[0]) {
|
switch (csiescseq.mode[0]) {
|
||||||
default:
|
default:
|
||||||
|
@ -2025,11 +2049,11 @@ csihandle(void)
|
||||||
break;
|
break;
|
||||||
case 'S': /* SU -- Scroll <n> line up */
|
case 'S': /* SU -- Scroll <n> line up */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tscrollup(term.top, csiescseq.arg[0], 0);
|
tscrollup(term.top, csiescseq.arg[0], 1);
|
||||||
break;
|
break;
|
||||||
case 'T': /* SD -- Scroll <n> line down */
|
case 'T': /* SD -- Scroll <n> line down */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tscrolldown(term.top, csiescseq.arg[0], 0);
|
tscrolldown(term.top, csiescseq.arg[0], 1);
|
||||||
break;
|
break;
|
||||||
case 'L': /* IL -- Insert <n> blank lines */
|
case 'L': /* IL -- Insert <n> blank lines */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
|
|
Loading…
Reference in a new issue