Fixed faulty format command
parent
010fb66cb6
commit
0a41016245
|
@ -1,11 +1,11 @@
|
||||||
# Upcoming
|
# Upcoming
|
||||||
## v0.1
|
## v1.0
|
||||||
* Switched build to CMake
|
* Switched build to CMake
|
||||||
* Completely overhauled code structure
|
* Completely overhauled code structure
|
||||||
* Add a desktop entry when installing
|
* Add a desktop entry when installing
|
||||||
based on [desktopentry](https://st.suckless.org/patches/desktopentry/)
|
based on [desktopentry](https://st.suckless.org/patches/desktopentry/)
|
||||||
|
|
||||||
## v0.2
|
## v1.1
|
||||||
* Configurable transparency (focused and unfocused)
|
* Configurable transparency (focused and unfocused)
|
||||||
based on [alpha](https://st.suckless.org/patches/alpha/) and
|
based on [alpha](https://st.suckless.org/patches/alpha/) and
|
||||||
[alpha focus highlight](https://st.suckless.org/patches/alpha_focus_highlight/)
|
[alpha focus highlight](https://st.suckless.org/patches/alpha_focus_highlight/)
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
* Copy to clipboard on selection
|
* Copy to clipboard on selection
|
||||||
based on [one clipboard](https://st.suckless.org/patches/clipboard/)
|
based on [one clipboard](https://st.suckless.org/patches/clipboard/)
|
||||||
|
|
||||||
## v0.3
|
## v1.2
|
||||||
* Add better/gapless rendering of lines/blocks
|
* Add better/gapless rendering of lines/blocks
|
||||||
based on [boxdraw](https://st.suckless.org/patches/boxdraw/)
|
based on [boxdraw](https://st.suckless.org/patches/boxdraw/)
|
||||||
* Add support for multiple fonts
|
* Add support for multiple fonts
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
* Hide cursor when working in the terminal
|
* Hide cursor when working in the terminal
|
||||||
based on [hidecursor](https://st.suckless.org/patches/hidecursor/)
|
based on [hidecursor](https://st.suckless.org/patches/hidecursor/)
|
||||||
|
|
||||||
## v0.4
|
## v1.3
|
||||||
* Add ligature support
|
* Add ligature support
|
||||||
based on [ligature support](https://st.suckless.org/patches/ligatures/)
|
based on [ligature support](https://st.suckless.org/patches/ligatures/)
|
||||||
* Support for multiple color pallets
|
* Support for multiple color pallets
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -90,4 +90,4 @@ clean-debug:
|
||||||
|
|
||||||
# =====FORMAT CODE=====
|
# =====FORMAT CODE=====
|
||||||
format:
|
format:
|
||||||
@ clang-format -i --style=file src/**/*.c src/**/*.h
|
@ find src/ -iname '*.c' -or -iname '*.h' | xargs clang-format --style=file -i
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#include "utf8.h"
|
|
||||||
#include "../win.h"
|
#include "../win.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "st.h"
|
#include "st.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
|
||||||
#if defined(__linux)
|
#if defined(__linux)
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
|
@ -204,7 +204,6 @@ static void selnormalize(void);
|
||||||
static void selscroll(int, int);
|
static void selscroll(int, int);
|
||||||
static void selsnap(int *, int *, int);
|
static void selsnap(int *, int *, int);
|
||||||
|
|
||||||
|
|
||||||
static char *base64dec(const char *);
|
static char *base64dec(const char *);
|
||||||
static char base64dec_getc(const char **);
|
static char base64dec_getc(const char **);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ enum selection_type { SEL_REGULAR = 1, SEL_RECTANGULAR = 2 };
|
||||||
|
|
||||||
enum selection_snap { SNAP_WORD = 1, SNAP_LINE = 2 };
|
enum selection_snap { SNAP_WORD = 1, SNAP_LINE = 2 };
|
||||||
|
|
||||||
|
|
||||||
#define Glyph Glyph_
|
#define Glyph Glyph_
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Rune u; /* character code */
|
Rune u; /* character code */
|
||||||
|
|
|
@ -91,11 +91,13 @@ char utf8encodebyte(Rune u, size_t i) { return utfbyte[i] | (u & ~utfmask[i]); }
|
||||||
* @param i
|
* @param i
|
||||||
*/
|
*/
|
||||||
size_t utf8validate(Rune *p_rune, size_t i) {
|
size_t utf8validate(Rune *p_rune, size_t i) {
|
||||||
if (!BETWEEN(*p_rune, utfmin[i], utfmax[i]) || BETWEEN(*p_rune, 0xD800, 0xDFFF))
|
if (!BETWEEN(*p_rune, utfmin[i], utfmax[i]) ||
|
||||||
|
BETWEEN(*p_rune, 0xD800, 0xDFFF))
|
||||||
*p_rune = UTF_INVALID;
|
*p_rune = UTF_INVALID;
|
||||||
|
|
||||||
// Count up i until you find a utfmax entry that's greater than *p_rune
|
// Count up i until you find a utfmax entry that's greater than *p_rune
|
||||||
for (i = 1; *p_rune > utfmax[i]; ++i);
|
for (i = 1; *p_rune > utfmax[i]; ++i)
|
||||||
|
;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef UTF8_H
|
#ifndef UTF8_H
|
||||||
#define UTF8_H
|
#define UTF8_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define UTF_INVALID 0xFFFD
|
#define UTF_INVALID 0xFFFD
|
||||||
#define UTF_SIZE 4
|
#define UTF_SIZE 4
|
||||||
|
|
55
src/x.c
55
src/x.c
|
@ -379,11 +379,11 @@ void mousereport(XEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SET(MODE_MOUSESGR)) {
|
if (IS_SET(MODE_MOUSESGR)) {
|
||||||
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1, y + 1,
|
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1,
|
||||||
e->xbutton.type == ButtonRelease ? 'm' : 'M');
|
y + 1, e->xbutton.type == ButtonRelease ? 'm' : 'M');
|
||||||
} else if (x < 223 && y < 223) {
|
} else if (x < 223 && y < 223) {
|
||||||
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button, 32 + x + 1,
|
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button,
|
||||||
32 + y + 1);
|
32 + x + 1, 32 + y + 1);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -569,8 +569,8 @@ void selrequest(XEvent *e) {
|
||||||
if (xsre->target == xa_targets) {
|
if (xsre->target == xa_targets) {
|
||||||
/* respond with the supported type */
|
/* respond with the supported type */
|
||||||
string = xsel.xtarget;
|
string = xsel.xtarget;
|
||||||
XChangeProperty(xsre->display, xsre->requestor, xsre->property, XA_ATOM, 32,
|
XChangeProperty(xsre->display, xsre->requestor, xsre->property, XA_ATOM,
|
||||||
PropModeReplace, (uchar *)&string, 1);
|
32, PropModeReplace, (uchar *)&string, 1);
|
||||||
xev.property = xsre->property;
|
xev.property = xsre->property;
|
||||||
} else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) {
|
} else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) {
|
||||||
/*
|
/*
|
||||||
|
@ -583,7 +583,8 @@ void selrequest(XEvent *e) {
|
||||||
} else if (xsre->selection == clipboard) {
|
} else if (xsre->selection == clipboard) {
|
||||||
seltext = xsel.clipboard;
|
seltext = xsel.clipboard;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Unhandled clipboard selection 0x%lx\n", xsre->selection);
|
fprintf(stderr, "Unhandled clipboard selection 0x%lx\n",
|
||||||
|
xsre->selection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (seltext != NULL) {
|
if (seltext != NULL) {
|
||||||
|
@ -657,8 +658,8 @@ void xresize(int col, int row) {
|
||||||
win.th = row * win.ch;
|
win.th = row * win.ch;
|
||||||
|
|
||||||
XFreePixmap(xw.dpy, xw.buf);
|
XFreePixmap(xw.dpy, xw.buf);
|
||||||
xw.buf =
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr));
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XftDrawChange(xw.draw, xw.buf);
|
XftDrawChange(xw.draw, xw.buf);
|
||||||
xclear(0, 0, win.w, win.h);
|
xclear(0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
@ -950,12 +951,13 @@ int ximopen(Display *dpy) {
|
||||||
fprintf(stderr, "XSetIMValues: "
|
fprintf(stderr, "XSetIMValues: "
|
||||||
"Could not set XNDestroyCallback.\n");
|
"Could not set XNDestroyCallback.\n");
|
||||||
|
|
||||||
xw.ime.spotlist = XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot, NULL);
|
xw.ime.spotlist =
|
||||||
|
XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot, NULL);
|
||||||
|
|
||||||
if (xw.ime.xic == NULL) {
|
if (xw.ime.xic == NULL) {
|
||||||
xw.ime.xic = XCreateIC(xw.ime.xim, XNInputStyle,
|
xw.ime.xic = XCreateIC(
|
||||||
XIMPreeditNothing | XIMStatusNothing, XNClientWindow,
|
xw.ime.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||||
xw.win, XNDestroyCallback, &icdestroy, NULL);
|
XNClientWindow, xw.win, XNDestroyCallback, &icdestroy, NULL);
|
||||||
}
|
}
|
||||||
if (xw.ime.xic == NULL)
|
if (xw.ime.xic == NULL)
|
||||||
fprintf(stderr, "XCreateIC: Could not create input context.\n");
|
fprintf(stderr, "XCreateIC: Could not create input context.\n");
|
||||||
|
@ -965,8 +967,8 @@ int ximopen(Display *dpy) {
|
||||||
|
|
||||||
void ximinstantiate(Display *dpy, XPointer client, XPointer call) {
|
void ximinstantiate(Display *dpy, XPointer client, XPointer call) {
|
||||||
if (ximopen(dpy))
|
if (ximopen(dpy))
|
||||||
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate,
|
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
||||||
NULL);
|
ximinstantiate, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ximdestroy(XIM xim, XPointer client, XPointer call) {
|
void ximdestroy(XIM xim, XPointer client, XPointer call) {
|
||||||
|
@ -1033,8 +1035,8 @@ void xinit(int cols, int rows) {
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||||
gcvalues.graphics_exposures = False;
|
gcvalues.graphics_exposures = False;
|
||||||
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues);
|
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues);
|
||||||
xw.buf =
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr));
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
@ -1075,8 +1077,8 @@ void xinit(int cols, int rows) {
|
||||||
XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
|
XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
|
||||||
|
|
||||||
xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False);
|
xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False);
|
||||||
XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, PropModeReplace,
|
XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32,
|
||||||
(uchar *)&thispid, 1);
|
PropModeReplace, (uchar *)&thispid, 1);
|
||||||
|
|
||||||
win.mode = MODE_NUMLOCK;
|
win.mode = MODE_NUMLOCK;
|
||||||
resettitle();
|
resettitle();
|
||||||
|
@ -1155,7 +1157,8 @@ int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len,
|
||||||
if (glyphidx && frc[f].flags == frcflags)
|
if (glyphidx && frc[f].flags == frcflags)
|
||||||
break;
|
break;
|
||||||
/* We got a default font for a not found glyph. */
|
/* We got a default font for a not found glyph. */
|
||||||
if (!glyphidx && frc[f].flags == frcflags && frc[f].unicodep == rune) {
|
if (!glyphidx && frc[f].flags == frcflags &&
|
||||||
|
frc[f].unicodep == rune) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1310,10 +1313,12 @@ void xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len,
|
||||||
/* Intelligent cleaning up of the borders. */
|
/* Intelligent cleaning up of the borders. */
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
xclear(0, (y == 0) ? 0 : winy, borderpx,
|
xclear(0, (y == 0) ? 0 : winy, borderpx,
|
||||||
winy + win.ch + ((winy + win.ch >= borderpx + win.th) ? win.h : 0));
|
winy + win.ch +
|
||||||
|
((winy + win.ch >= borderpx + win.th) ? win.h : 0));
|
||||||
}
|
}
|
||||||
if (winx + width >= borderpx + win.tw) {
|
if (winx + width >= borderpx + win.tw) {
|
||||||
xclear(winx + width, (y == 0) ? 0 : winy, win.w,
|
xclear(
|
||||||
|
winx + width, (y == 0) ? 0 : winy, win.w,
|
||||||
((winy + win.ch >= borderpx + win.th) ? win.h : (winy + win.ch)));
|
((winy + win.ch >= borderpx + win.th) ? win.h : (winy + win.ch)));
|
||||||
}
|
}
|
||||||
if (y == 0)
|
if (y == 0)
|
||||||
|
@ -1369,7 +1374,8 @@ void xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) {
|
||||||
/*
|
/*
|
||||||
* Select the right color for the right mode.
|
* Select the right color for the right mode.
|
||||||
*/
|
*/
|
||||||
g.mode &= ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK | ATTR_WIDE;
|
g.mode &=
|
||||||
|
ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK | ATTR_WIDE;
|
||||||
|
|
||||||
if (IS_SET(MODE_REVERSE)) {
|
if (IS_SET(MODE_REVERSE)) {
|
||||||
g.mode |= ATTR_REVERSE;
|
g.mode |= ATTR_REVERSE;
|
||||||
|
@ -1754,7 +1760,8 @@ void run(void) {
|
||||||
trigger = now;
|
trigger = now;
|
||||||
drawing = 1;
|
drawing = 1;
|
||||||
}
|
}
|
||||||
timeout = (maxlatency - TIMEDIFF(now, trigger)) / maxlatency * minlatency;
|
timeout =
|
||||||
|
(maxlatency - TIMEDIFF(now, trigger)) / maxlatency * minlatency;
|
||||||
if (timeout > 0)
|
if (timeout > 0)
|
||||||
continue; /* we have time, try to find idle */
|
continue; /* we have time, try to find idle */
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue