Fixed faulty format command
							parent
							
								
									010fb66cb6
								
							
						
					
					
						commit
						0a41016245
					
				|  | @ -1,11 +1,11 @@ | |||
| # Upcoming | ||||
| ## v0.1 | ||||
| ## v1.0 | ||||
| * Switched build to CMake | ||||
| * Completely overhauled code structure | ||||
| * Add a desktop entry when installing | ||||
|   based on [desktopentry](https://st.suckless.org/patches/desktopentry/) | ||||
| 
 | ||||
| ## v0.2 | ||||
| ## v1.1 | ||||
| * Configurable transparency (focused and unfocused) | ||||
|   based on [alpha](https://st.suckless.org/patches/alpha/) and  | ||||
|   [alpha focus highlight](https://st.suckless.org/patches/alpha_focus_highlight/) | ||||
|  | @ -14,7 +14,7 @@ | |||
| * Copy to clipboard on selection | ||||
|   based on [one clipboard](https://st.suckless.org/patches/clipboard/) | ||||
| 
 | ||||
| ## v0.3 | ||||
| ## v1.2 | ||||
| * Add better/gapless rendering of lines/blocks | ||||
|   based on [boxdraw](https://st.suckless.org/patches/boxdraw/) | ||||
| * Add support for multiple fonts | ||||
|  | @ -22,7 +22,7 @@ | |||
| * Hide cursor when working in the terminal | ||||
|   based on [hidecursor](https://st.suckless.org/patches/hidecursor/) | ||||
| 
 | ||||
| ## v0.4 | ||||
| ## v1.3 | ||||
| * Add ligature support | ||||
|   based on [ligature support](https://st.suckless.org/patches/ligatures/) | ||||
| * Support for multiple color pallets | ||||
|  |  | |||
							
								
								
									
										2
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										2
									
								
								Makefile
								
								
								
								
							|  | @ -90,4 +90,4 @@ clean-debug: | |||
| 
 | ||||
| # =====FORMAT CODE=====
 | ||||
| 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 <wchar.h> | ||||
| 
 | ||||
| #include "utf8.h" | ||||
| #include "../win.h" | ||||
| #include "macros.h" | ||||
| #include "st.h" | ||||
| #include "utf8.h" | ||||
| 
 | ||||
| #if defined(__linux) | ||||
| #include <pty.h> | ||||
|  | @ -204,7 +204,6 @@ static void selnormalize(void); | |||
| static void selscroll(int, int); | ||||
| static void selsnap(int *, int *, int); | ||||
| 
 | ||||
| 
 | ||||
| static char *base64dec(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 }; | ||||
| 
 | ||||
| 
 | ||||
| #define Glyph Glyph_ | ||||
| typedef struct { | ||||
|     Rune u;      /* character code */ | ||||
|  |  | |||
|  | @ -91,11 +91,13 @@ char utf8encodebyte(Rune u, size_t i) { return utfbyte[i] | (u & ~utfmask[i]); } | |||
|  * @param 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; | ||||
| 
 | ||||
|     // 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; | ||||
| } | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| #ifndef UTF8_H | ||||
| #define UTF8_H | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| #include <stdint.h> | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| #define UTF_INVALID 0xFFFD | ||||
| #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)) { | ||||
|     len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1, y + 1, | ||||
|                    e->xbutton.type == ButtonRelease ? 'm' : 'M'); | ||||
|         len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1, | ||||
|                        y + 1, e->xbutton.type == ButtonRelease ? 'm' : 'M'); | ||||
|     } else if (x < 223 && y < 223) { | ||||
|     len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button, 32 + x + 1, | ||||
|                    32 + y + 1); | ||||
|         len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button, | ||||
|                        32 + x + 1, 32 + y + 1); | ||||
|     } else { | ||||
|         return; | ||||
|     } | ||||
|  | @ -569,8 +569,8 @@ void selrequest(XEvent *e) { | |||
|     if (xsre->target == xa_targets) { | ||||
|         /* respond with the supported type */ | ||||
|         string = xsel.xtarget; | ||||
|     XChangeProperty(xsre->display, xsre->requestor, xsre->property, XA_ATOM, 32, | ||||
|                     PropModeReplace, (uchar *)&string, 1); | ||||
|         XChangeProperty(xsre->display, xsre->requestor, xsre->property, XA_ATOM, | ||||
|                         32, PropModeReplace, (uchar *)&string, 1); | ||||
|         xev.property = xsre->property; | ||||
|     } else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) { | ||||
|         /*
 | ||||
|  | @ -583,7 +583,8 @@ void selrequest(XEvent *e) { | |||
|         } else if (xsre->selection == clipboard) { | ||||
|             seltext = xsel.clipboard; | ||||
|         } else { | ||||
|       fprintf(stderr, "Unhandled clipboard selection 0x%lx\n", xsre->selection); | ||||
|             fprintf(stderr, "Unhandled clipboard selection 0x%lx\n", | ||||
|                     xsre->selection); | ||||
|             return; | ||||
|         } | ||||
|         if (seltext != NULL) { | ||||
|  | @ -657,8 +658,8 @@ void xresize(int col, int row) { | |||
|     win.th = row * win.ch; | ||||
| 
 | ||||
|     XFreePixmap(xw.dpy, xw.buf); | ||||
|   xw.buf = | ||||
|       XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); | ||||
|     xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, | ||||
|                            DefaultDepth(xw.dpy, xw.scr)); | ||||
|     XftDrawChange(xw.draw, xw.buf); | ||||
|     xclear(0, 0, win.w, win.h); | ||||
| 
 | ||||
|  | @ -950,12 +951,13 @@ int ximopen(Display *dpy) { | |||
|         fprintf(stderr, "XSetIMValues: " | ||||
|                         "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) { | ||||
|     xw.ime.xic = XCreateIC(xw.ime.xim, XNInputStyle, | ||||
|                            XIMPreeditNothing | XIMStatusNothing, XNClientWindow, | ||||
|                            xw.win, XNDestroyCallback, &icdestroy, NULL); | ||||
|         xw.ime.xic = XCreateIC( | ||||
|             xw.ime.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, | ||||
|             XNClientWindow, xw.win, XNDestroyCallback, &icdestroy, NULL); | ||||
|     } | ||||
|     if (xw.ime.xic == NULL) | ||||
|         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) { | ||||
|     if (ximopen(dpy)) | ||||
|     XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate, | ||||
|                                      NULL); | ||||
|         XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, | ||||
|                                          ximinstantiate, NULL); | ||||
| } | ||||
| 
 | ||||
| void ximdestroy(XIM xim, XPointer client, XPointer call) { | ||||
|  | @ -1033,8 +1035,8 @@ void xinit(int cols, int rows) { | |||
|     memset(&gcvalues, 0, sizeof(gcvalues)); | ||||
|     gcvalues.graphics_exposures = False; | ||||
|     dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues); | ||||
|   xw.buf = | ||||
|       XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); | ||||
|     xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, | ||||
|                            DefaultDepth(xw.dpy, xw.scr)); | ||||
|     XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); | ||||
|     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); | ||||
| 
 | ||||
|     xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False); | ||||
|   XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, PropModeReplace, | ||||
|                   (uchar *)&thispid, 1); | ||||
|     XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, | ||||
|                     PropModeReplace, (uchar *)&thispid, 1); | ||||
| 
 | ||||
|     win.mode = MODE_NUMLOCK; | ||||
|     resettitle(); | ||||
|  | @ -1155,7 +1157,8 @@ int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, | |||
|             if (glyphidx && frc[f].flags == frcflags) | ||||
|                 break; | ||||
|             /* 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; | ||||
|             } | ||||
|         } | ||||
|  | @ -1310,10 +1313,12 @@ void xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, | |||
|     /* Intelligent cleaning up of the borders. */ | ||||
|     if (x == 0) { | ||||
|         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) { | ||||
|     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))); | ||||
|     } | ||||
|     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. | ||||
|      */ | ||||
|   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)) { | ||||
|         g.mode |= ATTR_REVERSE; | ||||
|  | @ -1754,7 +1760,8 @@ void run(void) { | |||
|                 trigger = now; | ||||
|                 drawing = 1; | ||||
|             } | ||||
|       timeout = (maxlatency - TIMEDIFF(now, trigger)) / maxlatency * minlatency; | ||||
|             timeout = | ||||
|                 (maxlatency - TIMEDIFF(now, trigger)) / maxlatency * minlatency; | ||||
|             if (timeout > 0) | ||||
|                 continue; /* we have time, try to find idle */ | ||||
|         } | ||||
|  |  | |||
		Reference in New Issue