mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
Compare commits
5 Commits
6c03c605d9
...
33db255a2d
Author | SHA1 | Date | |
---|---|---|---|
|
33db255a2d | ||
|
3181d6876b | ||
|
15639f8e0e | ||
|
7a581fe4e1 | ||
|
48c85cdcf5 |
@ -44,6 +44,9 @@ Personal build of st generated using [st-flexipatch](https://github.com/bakkeby/
|
|||||||
- [iso14755](https://st.suckless.org/patches/iso14755/)
|
- [iso14755](https://st.suckless.org/patches/iso14755/)
|
||||||
- pressing the default binding Ctrl+Shift-i will popup dmenu, asking you to enter a unicode codepoint that will be converted to a glyph and then pushed to st
|
- pressing the default binding Ctrl+Shift-i will popup dmenu, asking you to enter a unicode codepoint that will be converted to a glyph and then pushed to st
|
||||||
|
|
||||||
|
- [keyboard-select](https://st.suckless.org/patches/keyboard_select/)
|
||||||
|
- allows you to select text on the terminal using keyboard shortcuts
|
||||||
|
|
||||||
- [ligatures](https://st.suckless.org/patches/ligatures/)
|
- [ligatures](https://st.suckless.org/patches/ligatures/)
|
||||||
- adds support for drawing ligatures using the Harfbuzz library to transform original text of a single line to a list of glyphs with ligatures included
|
- adds support for drawing ligatures using the Harfbuzz library to transform original text of a single line to a list of glyphs with ligatures included
|
||||||
|
|
||||||
|
4
config.h
4
config.h
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||||
*/
|
*/
|
||||||
static char *font = "JetBrains Mono:pixelsize=12:antialias=true:autohint=true";
|
static char *font = "JetBrains Mono:pixelsize=13:antialias=true:autohint=true";
|
||||||
#if FONT2_PATCH
|
#if FONT2_PATCH
|
||||||
/* Spare fonts */
|
/* Spare fonts */
|
||||||
static char *font2[] = {
|
static char *font2[] = {
|
||||||
@ -166,7 +166,7 @@ unsigned int tabspaces = 8;
|
|||||||
|
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
/* bg opacity */
|
/* bg opacity */
|
||||||
float alpha = 1.0;
|
float alpha = 0.50;
|
||||||
#if ALPHA_GRADIENT_PATCH
|
#if ALPHA_GRADIENT_PATCH
|
||||||
float grad_alpha = 0.54; //alpha value that'll change
|
float grad_alpha = 0.54; //alpha value that'll change
|
||||||
float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
|
float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
|
||||||
|
@ -77,7 +77,7 @@ treflow_moveimages(int oldy, int newy)
|
|||||||
void
|
void
|
||||||
treflow(int col, int row)
|
treflow(int col, int row)
|
||||||
{
|
{
|
||||||
int i, j, x, x2;
|
int i, j;
|
||||||
int oce, nce, bot, scr;
|
int oce, nce, bot, scr;
|
||||||
int ox = 0, oy = -term.histf, nx = 0, ny = -1, len;
|
int ox = 0, oy = -term.histf, nx = 0, ny = -1, len;
|
||||||
int cy = -1; /* proxy for new y coordinate of cursor */
|
int cy = -1; /* proxy for new y coordinate of cursor */
|
||||||
@ -220,13 +220,12 @@ treflow(int col, int row)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* expand images into new text cells */
|
/* expand images into new text cells */
|
||||||
for (im = term.images; im; im = next) {
|
for (im = term.images; im; im = im->next) {
|
||||||
next = im->next;
|
j = MIN(im->x + im->cols, col);
|
||||||
if (im->x < col) {
|
line = TLINE(im->y);
|
||||||
line = TLINE(im->y);
|
for (i = im->x; i < j; i++) {
|
||||||
x2 = MIN(im->x + im->cols, col);
|
if (!(line[i].mode & ATTR_SET))
|
||||||
for (x = im->x; x < x2; x++)
|
line[i].mode |= ATTR_SIXEL;
|
||||||
line[x].mode |= ATTR_SIXEL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
|
@ -223,7 +223,7 @@
|
|||||||
*
|
*
|
||||||
* https://st.suckless.org/patches/keyboard_select/
|
* https://st.suckless.org/patches/keyboard_select/
|
||||||
*/
|
*/
|
||||||
#define KEYBOARDSELECT_PATCH 0
|
#define KEYBOARDSELECT_PATCH 1
|
||||||
|
|
||||||
/* This patch adds support for drawing ligatures using the Harfbuzz library to transform
|
/* This patch adds support for drawing ligatures using the Harfbuzz library to transform
|
||||||
* original text of a single line to a list of glyphs with ligatures included.
|
* original text of a single line to a list of glyphs with ligatures included.
|
||||||
|
77
st.c
77
st.c
@ -220,6 +220,9 @@ static void tsetattr(const int *, int);
|
|||||||
static void tsetchar(Rune, const Glyph *, int, int);
|
static void tsetchar(Rune, const Glyph *, int, int);
|
||||||
static void tsetdirt(int, int);
|
static void tsetdirt(int, int);
|
||||||
static void tsetscroll(int, int);
|
static void tsetscroll(int, int);
|
||||||
|
#if SIXEL_PATCH
|
||||||
|
static inline void tsetsixelattr(Line line, int x1, int x2);
|
||||||
|
#endif // SIXEL_PATCH
|
||||||
static void tswapscreen(void);
|
static void tswapscreen(void);
|
||||||
static void tsetmode(int, int, const int *, int);
|
static void tsetmode(int, int, const int *, int);
|
||||||
static int twrite(const char *, int, int);
|
static int twrite(const char *, int, int);
|
||||||
@ -1149,6 +1152,15 @@ tsetdirtattr(int attr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SIXEL_PATCH
|
||||||
|
void
|
||||||
|
tsetsixelattr(Line line, int x1, int x2)
|
||||||
|
{
|
||||||
|
for (; x1 <= x2; x1++)
|
||||||
|
line[x1].mode |= ATTR_SIXEL;
|
||||||
|
}
|
||||||
|
#endif // SIXEL_PATCH
|
||||||
|
|
||||||
void
|
void
|
||||||
tfulldirt(void)
|
tfulldirt(void)
|
||||||
{
|
{
|
||||||
@ -2592,7 +2604,7 @@ strhandle(void)
|
|||||||
};
|
};
|
||||||
#if SIXEL_PATCH
|
#if SIXEL_PATCH
|
||||||
ImageList *im, *newimages, *next, *tail;
|
ImageList *im, *newimages, *next, *tail;
|
||||||
int i, x, y, x1, y1, x2, y2, numimages;
|
int i, x1, y1, x2, y2, numimages;
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
Line line;
|
Line line;
|
||||||
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
||||||
@ -2736,36 +2748,44 @@ strhandle(void)
|
|||||||
} else {
|
} else {
|
||||||
term.images = newimages;
|
term.images = newimages;
|
||||||
}
|
}
|
||||||
x2 = MIN(x2, term.col);
|
#if COLUMNS_PATCH && !REFLOW
|
||||||
for (i = 0, im = newimages; im; im = next, i++) {
|
x2 = MIN(x2, term.maxcol) - 1;
|
||||||
next = im->next;
|
#else
|
||||||
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
x2 = MIN(x2, term.col) - 1;
|
||||||
scr = IS_SET(MODE_ALTSCREEN) ? 0 : term.scr;
|
#endif // COLUMNS_PATCH
|
||||||
#endif // SCROLLBACK_PATCH
|
if (IS_SET(MODE_SIXEL_SDM)) {
|
||||||
if (IS_SET(MODE_SIXEL_SDM)) {
|
/* Sixel display mode: put the sixel in the upper left corner of
|
||||||
|
* the screen, disable scrolling (the sixel will be truncated if
|
||||||
|
* it is too long) and do not change the cursor position. */
|
||||||
|
for (i = 0, im = newimages; im; im = next, i++) {
|
||||||
|
next = im->next;
|
||||||
if (i >= term.row) {
|
if (i >= term.row) {
|
||||||
delete_image(im);
|
delete_image(im);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
im->y = i + scr;
|
im->y = i + scr;
|
||||||
line = term.line[i];
|
tsetsixelattr(term.line[i], x1, x2);
|
||||||
} else {
|
term.dirty[MIN(im->y, term.row-1)] = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0, im = newimages; im; im = next, i++) {
|
||||||
|
next = im->next;
|
||||||
|
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
||||||
|
scr = IS_SET(MODE_ALTSCREEN) ? 0 : term.scr;
|
||||||
|
#endif // SCROLLBACK_PATCH
|
||||||
im->y = term.c.y + scr;
|
im->y = term.c.y + scr;
|
||||||
line = term.line[term.c.y];
|
tsetsixelattr(term.line[term.c.y], x1, x2);
|
||||||
}
|
term.dirty[MIN(im->y, term.row-1)] = 1;
|
||||||
for (x = im->x; x < x2; x++) {
|
if (i < numimages-1) {
|
||||||
line[x].mode |= ATTR_SIXEL;
|
im->next = NULL;
|
||||||
}
|
tnewline(0);
|
||||||
term.dirty[MIN(im->y, term.row-1)] = 1;
|
im->next = next;
|
||||||
if (!IS_SET(MODE_SIXEL_SDM) && i < numimages-1) {
|
}
|
||||||
im->next = NULL;
|
|
||||||
tnewline(0);
|
|
||||||
im->next = next;
|
|
||||||
}
|
}
|
||||||
|
/* if mode 8452 is set, sixel scrolling leaves cursor to right of graphic */
|
||||||
|
if (IS_SET(MODE_SIXEL_CUR_RT))
|
||||||
|
term.c.x = MIN(term.c.x + newimages->cols, term.col-1);
|
||||||
}
|
}
|
||||||
/* if mode 8452 is set, sixel scrolling leaves cursor to right of graphic */
|
|
||||||
if (!IS_SET(MODE_SIXEL_SDM) && IS_SET(MODE_SIXEL_CUR_RT))
|
|
||||||
term.c.x = MIN(term.c.x + newimages->cols, term.col-1);
|
|
||||||
}
|
}
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
#if SYNC_PATCH
|
#if SYNC_PATCH
|
||||||
@ -3505,7 +3525,7 @@ tresize(int col, int row)
|
|||||||
#endif // COLUMNS_PATCH
|
#endif // COLUMNS_PATCH
|
||||||
int *bp;
|
int *bp;
|
||||||
#if SIXEL_PATCH
|
#if SIXEL_PATCH
|
||||||
int x, x2;
|
int x2;
|
||||||
Line line;
|
Line line;
|
||||||
ImageList *im, *next;
|
ImageList *im, *next;
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
@ -3612,8 +3632,7 @@ tresize(int col, int row)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if SIXEL_PATCH
|
#if SIXEL_PATCH
|
||||||
/* expand images into new text cells to prevent them from being deleted in
|
/* expand images into new text cells */
|
||||||
* xfinishdraw() that draws the images */
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for (im = term.images; im; im = next) {
|
for (im = term.images; im; im = next) {
|
||||||
next = im->next;
|
next = im->next;
|
||||||
@ -3638,9 +3657,9 @@ tresize(int col, int row)
|
|||||||
}
|
}
|
||||||
line = term.line[im->y];
|
line = term.line[im->y];
|
||||||
#endif // SCROLLBACK_PATCH
|
#endif // SCROLLBACK_PATCH
|
||||||
x2 = MIN(im->x + im->cols, term.col);
|
x2 = MIN(im->x + im->cols, col) - 1;
|
||||||
for (x = im->x; x < x2; x++)
|
if (mincol < col && x2 >= mincol && im->x < col)
|
||||||
line[x].mode |= ATTR_SIXEL;
|
tsetsixelattr(line, MAX(im->x, mincol), x2);
|
||||||
}
|
}
|
||||||
tswapscreen();
|
tswapscreen();
|
||||||
}
|
}
|
||||||
|
78
x.c
78
x.c
@ -3167,9 +3167,14 @@ xfinishdraw(void)
|
|||||||
ImageList *im, *next;
|
ImageList *im, *next;
|
||||||
Imlib_Image origin, scaled;
|
Imlib_Image origin, scaled;
|
||||||
XGCValues gcvalues;
|
XGCValues gcvalues;
|
||||||
GC gc;
|
GC gc = NULL;
|
||||||
int width, height;
|
int width, height;
|
||||||
int x, x2, del, destx, desty;
|
int del, desty, mode, x1, x2, xend;
|
||||||
|
#if ANYSIZE_PATCH
|
||||||
|
int bw = win.hborderpx, bh = win.vborderpx;
|
||||||
|
#else
|
||||||
|
int bw = borderpx, bh = borderpx;
|
||||||
|
#endif // ANYSIZE_PATCH
|
||||||
Line line;
|
Line line;
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
|
|
||||||
@ -3260,43 +3265,50 @@ xfinishdraw(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clip the image so it does not go over to borders */
|
/* create GC */
|
||||||
x2 = MIN(im->x + im->cols, term.col);
|
if (!gc) {
|
||||||
width = MIN(width, (x2 - im->x) * win.cw);
|
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||||
|
gcvalues.graphics_exposures = False;
|
||||||
/* delete the image if the text cells behind it have been changed */
|
gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues);
|
||||||
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
|
||||||
line = TLINE(im->y);
|
|
||||||
#else
|
|
||||||
line = term.line[im->y];
|
|
||||||
#endif // SCROLLBACK_PATCH | REFLOW_PATCH
|
|
||||||
for (del = 0, x = im->x; x < x2; x++) {
|
|
||||||
if ((del = !(line[x].mode & ATTR_SIXEL)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (del) {
|
|
||||||
delete_image(im);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw the image */
|
/* set the clip mask */
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
desty = bh + im->y * win.ch;
|
||||||
gcvalues.graphics_exposures = False;
|
|
||||||
gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues);
|
|
||||||
#if ANYSIZE_PATCH
|
|
||||||
destx = win.hborderpx + im->x * win.cw;
|
|
||||||
desty = win.vborderpx + im->y * win.ch;
|
|
||||||
#else
|
|
||||||
destx = borderpx + im->x * win.cw;
|
|
||||||
desty = borderpx + im->y * win.ch;
|
|
||||||
#endif // ANYSIZE_PATCH
|
|
||||||
if (im->clipmask) {
|
if (im->clipmask) {
|
||||||
XSetClipMask(xw.dpy, gc, (Drawable)im->clipmask);
|
XSetClipMask(xw.dpy, gc, (Drawable)im->clipmask);
|
||||||
XSetClipOrigin(xw.dpy, gc, destx, desty);
|
XSetClipOrigin(xw.dpy, gc, bw + im->x * win.cw, desty);
|
||||||
}
|
}
|
||||||
XCopyArea(xw.dpy, (Drawable)im->pixmap, xw.buf, gc, 0, 0, width, height, destx, desty);
|
|
||||||
XFreeGC(xw.dpy, gc);
|
/* draw only the parts of the image that are not erased */
|
||||||
|
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
||||||
|
line = TLINE(im->y) + im->x;
|
||||||
|
#else
|
||||||
|
line = term.line[im->y] + im->x;
|
||||||
|
#endif // SCROLLBACK_PATCH || REFLOW_PATCH
|
||||||
|
xend = MIN(im->x + im->cols, term.col);
|
||||||
|
for (del = 1, x1 = im->x; x1 < xend; x1 = x2) {
|
||||||
|
mode = line->mode & ATTR_SIXEL;
|
||||||
|
for (x2 = x1 + 1; x2 < xend; x2++) {
|
||||||
|
if (((++line)->mode & ATTR_SIXEL) != mode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode) {
|
||||||
|
XCopyArea(xw.dpy, (Drawable)im->pixmap, xw.buf, gc,
|
||||||
|
(x1 - im->x) * win.cw, 0,
|
||||||
|
MIN((x2 - x1) * win.cw, width - (x1 - im->x) * win.cw), height,
|
||||||
|
bw + x1 * win.cw, desty);
|
||||||
|
del = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (im->clipmask)
|
||||||
|
XSetClipMask(xw.dpy, gc, None);
|
||||||
|
|
||||||
|
/* if all the parts are erased, we can delete the entire image */
|
||||||
|
if (del && im->x + im->cols <= term.col)
|
||||||
|
delete_image(im);
|
||||||
}
|
}
|
||||||
|
if (gc)
|
||||||
|
XFreeGC(xw.dpy, gc);
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
|
|
||||||
#if !SINGLE_DRAWABLE_BUFFER_PATCH
|
#if !SINGLE_DRAWABLE_BUFFER_PATCH
|
||||||
|
Loading…
Reference in New Issue
Block a user