Fixed faulty format command

develop
Jef Roosens 2021-04-22 10:19:33 +02:00
parent 010fb66cb6
commit 0a41016245
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
9 changed files with 1362 additions and 1355 deletions

View File

@ -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

View File

@ -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

View File

@ -10,39 +10,39 @@ extern char *argv0;
/* use main(int argc, char *argv[]) */ /* use main(int argc, char *argv[]) */
#define ARGBEGIN \ #define ARGBEGIN \
for (argv0 = *argv, argv++, argc--; \ for (argv0 = *argv, argv++, argc--; \
argv[0] && argv[0][0] == '-' && argv[0][1]; argc--, argv++) { \ argv[0] && argv[0][0] == '-' && argv[0][1]; argc--, argv++) { \
char argc_; \ char argc_; \
char **argv_; \ char **argv_; \
int brk_; \ int brk_; \
if (argv[0][1] == '-' && argv[0][2] == '\0') { \ if (argv[0][1] == '-' && argv[0][2] == '\0') { \
argv++; \ argv++; \
argc--; \ argc--; \
break; \ break; \
} \ } \
int i_; \ int i_; \
for (i_ = 1, brk_ = 0, argv_ = argv; argv[0][i_] && !brk_; i_++) { \ for (i_ = 1, brk_ = 0, argv_ = argv; argv[0][i_] && !brk_; i_++) { \
if (argv_ != argv) \ if (argv_ != argv) \
break; \ break; \
argc_ = argv[0][i_]; \ argc_ = argv[0][i_]; \
switch (argc_) switch (argc_)
#define ARGEND \ #define ARGEND \
} \ } \
} }
#define ARGC() argc_ #define ARGC() argc_
#define EARGF(x) \ #define EARGF(x) \
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \ ((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
? ((x), abort(), (char *)0) \ ? ((x), abort(), (char *)0) \
: (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \ : (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \
: (argc--, argv++, argv[0]))) : (argc--, argv++, argv[0])))
#define ARGF() \ #define ARGF() \
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \ ((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
? (char *)0 \ ? (char *)0 \
: (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \ : (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \
: (argc--, argv++, argv[0]))) : (argc--, argv++, argv[0])))
#endif #endif

View File

@ -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 **);

View File

@ -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 */

View File

@ -64,7 +64,7 @@ Rune utf8decodebyte(char p_char, size_t *p_i) {
* *
* @param p_rune rune to encode * @param p_rune rune to encode
* @param p_char char array to encode to * @param p_char char array to encode to
* @return * @return
*/ */
size_t utf8encode(Rune p_rune, char *p_char) { size_t utf8encode(Rune p_rune, char *p_char) {
size_t len, i; size_t len, i;
@ -88,14 +88,16 @@ char utf8encodebyte(Rune u, size_t i) { return utfbyte[i] | (u & ~utfmask[i]); }
* Check if a given rune is a valid UTF-8 rune * Check if a given rune is a valid UTF-8 rune
* *
* @param p_rune rune to validate * @param p_rune rune to validate
* @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;
} }

View File

@ -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

View File

@ -6,26 +6,26 @@
#include "st/st.h" #include "st/st.h"
enum win_mode { enum win_mode {
MODE_VISIBLE = 1 << 0, MODE_VISIBLE = 1 << 0,
MODE_FOCUSED = 1 << 1, MODE_FOCUSED = 1 << 1,
MODE_APPKEYPAD = 1 << 2, MODE_APPKEYPAD = 1 << 2,
MODE_MOUSEBTN = 1 << 3, MODE_MOUSEBTN = 1 << 3,
MODE_MOUSEMOTION = 1 << 4, MODE_MOUSEMOTION = 1 << 4,
MODE_REVERSE = 1 << 5, MODE_REVERSE = 1 << 5,
MODE_KBDLOCK = 1 << 6, MODE_KBDLOCK = 1 << 6,
MODE_HIDE = 1 << 7, MODE_HIDE = 1 << 7,
MODE_APPCURSOR = 1 << 8, MODE_APPCURSOR = 1 << 8,
MODE_MOUSESGR = 1 << 9, MODE_MOUSESGR = 1 << 9,
MODE_8BIT = 1 << 10, MODE_8BIT = 1 << 10,
MODE_BLINK = 1 << 11, MODE_BLINK = 1 << 11,
MODE_FBLINK = 1 << 12, MODE_FBLINK = 1 << 12,
MODE_FOCUS = 1 << 13, MODE_FOCUS = 1 << 13,
MODE_MOUSEX10 = 1 << 14, MODE_MOUSEX10 = 1 << 14,
MODE_MOUSEMANY = 1 << 15, MODE_MOUSEMANY = 1 << 15,
MODE_BRCKTPASTE = 1 << 16, MODE_BRCKTPASTE = 1 << 16,
MODE_NUMLOCK = 1 << 17, MODE_NUMLOCK = 1 << 17,
MODE_MOUSE = MODE_MOUSE =
MODE_MOUSEBTN | MODE_MOUSEMOTION | MODE_MOUSEX10 | MODE_MOUSEMANY, MODE_MOUSEBTN | MODE_MOUSEMOTION | MODE_MOUSEX10 | MODE_MOUSEMANY,
}; };
void xbell(void); void xbell(void);

2599
src/x.c

File diff suppressed because it is too large Load Diff