Merge master into develop

develop
Jef Roosens 2020-12-01 18:02:48 +01:00
commit b6b60550d2
10 changed files with 4031 additions and 4457 deletions

34
README
View File

@ -1,34 +0,0 @@
st - simple terminal
--------------------
st is a simple terminal emulator for X which sucks less.
Requirements
------------
In order to build st you need the Xlib header files.
Installation
------------
Edit config.mk to match your local setup (st is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install st (if
necessary as root):
make clean install
Running st
----------
If you did not install st with make clean install, you must compile
the st terminfo entry with the following command:
tic -sx st.info
See the man page for additional details.
Credits
-------
Based on Aurélien APTEL <aurelien dot aptel at gmail dot com> bt source code.

25
README.md 100644
View File

@ -0,0 +1,25 @@
# stj
stj is my personal build of the st terminal. I use it as a ways of becoming
more familiar with the C programming language.
# Goals
- [x] Start using CMake
* Maybe also convert the Makefile wrapper to CMake?
- [ ] split the original codebase into logical segments I can work with
* use clang-format to keep things tidy
- [ ] apply my preferred patches, using the same structure as above
- [ ] clean up the config file; make it more accessible
# Cool ideas I want to try
- [ ] use the [tmux source code](https://github.com/tmux/tmux) to add tmux to
the terminal natively, adding only the features I use
- [ ] add a native shell? (possibly the
[ion shell](https://github.com/redox-os/ion))
# Installation
The provided Makefile is a wrapper around CMake. It allows you to build 2
versions: debug (the default) and release. The debug build doesn't optimize
anything, and adds the address sanitizer.
Running `make install` will build the release version, and install it in
`/usr/local` by default. The prefix can be changed in the Makefile.

View File

@ -7,7 +7,7 @@ endif()
# =====COMPILER=====
set(CMAKE_C_COMPILER "clang-10")
set(CMAKE_C_COMPILER "clang-11")
set(CMAKE_C_STANDARD 11)

View File

@ -9,10 +9,9 @@
extern char *argv0;
/* use main(int argc, char *argv[]) */
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
argv[0] && argv[0][0] == '-'\
&& argv[0][1];\
argc--, argv++) {\
#define ARGBEGIN \
for (argv0 = *argv, argv++, argc--; \
argv[0] && argv[0][0] == '-' && argv[0][1]; argc--, argv++) { \
char argc_; \
char **argv_; \
int brk_; \
@ -22,29 +21,28 @@ extern char *argv0;
break; \
} \
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) \
break; \
argc_ = argv[0][i_]; \
switch (argc_)
#define ARGEND }\
#define ARGEND \
} \
}
#define ARGC() argc_
#define EARGF(x) ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
((x), abort(), (char *)0) :\
(brk_ = 1, (argv[0][i_+1] != '\0')?\
(&argv[0][i_+1]) :\
(argc--, argv++, argv[0])))
#define EARGF(x) \
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
? ((x), abort(), (char *)0) \
: (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \
: (argc--, argv++, argv[0])))
#define ARGF() ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
(char *)0 :\
(brk_ = 1, (argv[0][i_+1] != '\0')?\
(&argv[0][i_+1]) :\
(argc--, argv++, argv[0])))
#define ARGF() \
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
? (char *)0 \
: (brk_ = 1, (argv[0][i_ + 1] != '\0') ? (&argv[0][i_ + 1]) \
: (argc--, argv++, argv[0])))
#endif

View File

@ -122,7 +122,6 @@ static const char *colorname[] = {
"#555555",
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
@ -466,7 +465,6 @@ static uint selmasks[] = {
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View File

@ -122,7 +122,6 @@ static const char *colorname[] = {
"#555555",
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
@ -466,7 +465,6 @@ static uint selmasks[] = {
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View File

@ -8,10 +8,10 @@
#define DIVCEIL(n, d) (((n) + ((d)-1)) / (d))
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \
(a).bg != (b).bg)
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
(t1.tv_nsec-t2.tv_nsec)/1E6)
#define ATTRCMP(a, b) \
((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
#define TIMEDIFF(t1, t2) \
((t1.tv_sec - t2.tv_sec) * 1000 + (t1.tv_nsec - t2.tv_nsec) / 1E6)
#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
#define TRUECOLOR(r, g, b) (1 << 24 | (r) << 16 | (g) << 8 | (b))

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,8 @@ enum win_mode {
MODE_MOUSEMANY = 1 << 15,
MODE_BRCKTPASTE = 1 << 16,
MODE_NUMLOCK = 1 << 17,
MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
|MODE_MOUSEMANY,
MODE_MOUSE =
MODE_MOUSEBTN | MODE_MOUSEMOTION | MODE_MOUSEX10 | MODE_MOUSEMANY,
};
void xbell(void);

565
src/x.c

File diff suppressed because it is too large Load Diff