Merge master into develop
commit
b6b60550d2
34
README
34
README
|
@ -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.
|
|
||||||
|
|
|
@ -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.
|
|
@ -7,7 +7,7 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
# =====COMPILER=====
|
# =====COMPILER=====
|
||||||
set(CMAKE_C_COMPILER "clang-10")
|
set(CMAKE_C_COMPILER "clang-11")
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
|
|
||||||
|
|
34
src/arg.h
34
src/arg.h
|
@ -9,10 +9,9 @@
|
||||||
extern char *argv0;
|
extern char *argv0;
|
||||||
|
|
||||||
/* use main(int argc, char *argv[]) */
|
/* use main(int argc, char *argv[]) */
|
||||||
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
|
#define ARGBEGIN \
|
||||||
argv[0] && argv[0][0] == '-'\
|
for (argv0 = *argv, argv++, argc--; \
|
||||||
&& argv[0][1];\
|
argv[0] && argv[0][0] == '-' && argv[0][1]; argc--, argv++) { \
|
||||||
argc--, argv++) {\
|
|
||||||
char argc_; \
|
char argc_; \
|
||||||
char **argv_; \
|
char **argv_; \
|
||||||
int brk_; \
|
int brk_; \
|
||||||
|
@ -22,29 +21,28 @@ extern char *argv0;
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
int i_; \
|
int i_; \
|
||||||
for (i_ = 1, brk_ = 0, argv_ = argv;\
|
for (i_ = 1, brk_ = 0, argv_ = argv; argv[0][i_] && !brk_; i_++) { \
|
||||||
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) ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
|
#define EARGF(x) \
|
||||||
((x), abort(), (char *)0) :\
|
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
|
||||||
(brk_ = 1, (argv[0][i_+1] != '\0')?\
|
? ((x), abort(), (char *)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() ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
|
#define ARGF() \
|
||||||
(char *)0 :\
|
((argv[0][i_ + 1] == '\0' && argv[1] == NULL) \
|
||||||
(brk_ = 1, (argv[0][i_+1] != '\0')?\
|
? (char *)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
|
||||||
|
|
|
@ -122,7 +122,6 @@ static const char *colorname[] = {
|
||||||
"#555555",
|
"#555555",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default colors (colorname index)
|
* Default colors (colorname index)
|
||||||
* foreground, background, cursor, reverse cursor
|
* foreground, background, cursor, reverse cursor
|
||||||
|
@ -466,7 +465,6 @@ static uint selmasks[] = {
|
||||||
* Printable characters in ASCII, used to estimate the advance width
|
* Printable characters in ASCII, used to estimate the advance width
|
||||||
* of single wide characters.
|
* of single wide characters.
|
||||||
*/
|
*/
|
||||||
static char ascii_printable[] =
|
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
|
||||||
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
|
||||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
||||||
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||||
|
|
|
@ -122,7 +122,6 @@ static const char *colorname[] = {
|
||||||
"#555555",
|
"#555555",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default colors (colorname index)
|
* Default colors (colorname index)
|
||||||
* foreground, background, cursor, reverse cursor
|
* foreground, background, cursor, reverse cursor
|
||||||
|
@ -466,7 +465,6 @@ static uint selmasks[] = {
|
||||||
* Printable characters in ASCII, used to estimate the advance width
|
* Printable characters in ASCII, used to estimate the advance width
|
||||||
* of single wide characters.
|
* of single wide characters.
|
||||||
*/
|
*/
|
||||||
static char ascii_printable[] =
|
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
|
||||||
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
|
||||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
||||||
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#define DIVCEIL(n, d) (((n) + ((d)-1)) / (d))
|
#define DIVCEIL(n, d) (((n) + ((d)-1)) / (d))
|
||||||
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
|
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
|
||||||
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
|
#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 || \
|
#define ATTRCMP(a, b) \
|
||||||
(a).bg != (b).bg)
|
((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
|
||||||
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
|
#define TIMEDIFF(t1, t2) \
|
||||||
(t1.tv_nsec-t2.tv_nsec)/1E6)
|
((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 MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
|
||||||
|
|
||||||
#define TRUECOLOR(r, g, b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
|
#define TRUECOLOR(r, g, b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
|
||||||
|
|
508
src/st/st.c
508
src/st/st.c
File diff suppressed because it is too large
Load Diff
|
@ -24,8 +24,8 @@ enum win_mode {
|
||||||
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_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
|
MODE_MOUSE =
|
||||||
|MODE_MOUSEMANY,
|
MODE_MOUSEBTN | MODE_MOUSEMOTION | MODE_MOUSEX10 | MODE_MOUSEMANY,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xbell(void);
|
void xbell(void);
|
||||||
|
|
Reference in New Issue