Updated st 0.8.1. Used new patches, scrollblock and alpha fixed.

Created run-patches.sh, runs all patches on clean st 0.8.1 code.
All old patches remvoed, including trasparency diff.
Not including solarized theme, don't see value of it.
Commented colornames array with color indexs from 0-15, includes index 255, and afterwards bg, fg and cursor, change those for background, foreground and cursor color. Seems better than solarized toggle.
Updated README.
This commit is contained in:
Kornelije Sajler 2018-04-25 22:15:11 +02:00
parent efad574780
commit 0ad3d4eddf
24 changed files with 3251 additions and 3233 deletions

2
FAQ
View file

@ -6,7 +6,7 @@ Use the excellent tool of [utmp](http://git.suckless.org/utmp/) for this task.
It means that st doesnt have any terminfo entry on your system. Chances are It means that st doesnt have any terminfo entry on your system. Chances are
you did not `make install`. If you just want to test it without installing it, you did not `make install`. If you just want to test it without installing it,
you can manualy run `tic -sx st.info`. you can manually run `tic -sx st.info`.
## Nothing works, and nothing is said about an unknown terminal! ## Nothing works, and nothing is said about an unknown terminal!

View file

@ -1,13 +1,16 @@
MIT/X Consortium License MIT/X Consortium License
© 2014-2018 Hiltjo Posthuma <hiltjo at codemadness dot org>
© 2018 Devin J. Pohly <djpohly at gmail dot com>
© 2014-2017 Quentin Rameau <quinq at fifth dot space>
© 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com> © 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com>
© 2009 Anselm R Garbe <garbeam at gmail dot com> © 2008-2017 Anselm R Garbe <garbeam at gmail dot com>
© 2012-2016 Roberto E. Vargas Caballero <k0ga at shike2 dot com> © 2012-2017 Roberto E. Vargas Caballero <k0ga at shike2 dot com>
© 2012-2016 Christoph Lohmann <20h at r-36 dot net> © 2012-2016 Christoph Lohmann <20h at r-36 dot net>
© 2013 Eon S. Jeon <esjeon at hyunmu dot am> © 2013 Eon S. Jeon <esjeon at hyunmu dot am>
© 2013 Alexander Sedov <alex0player at gmail dot com> © 2013 Alexander Sedov <alex0player at gmail dot com>
© 2013 Mark Edgar <medgar123 at gmail dot com> © 2013 Mark Edgar <medgar123 at gmail dot com>
© 2013 Eric Pruitt <eric.pruitt at gmail dot com> © 2013-2014 Eric Pruitt <eric.pruitt at gmail dot com>
© 2013 Michael Forney <mforney at mforney dot org> © 2013 Michael Forney <mforney at mforney dot org>
© 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de> © 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
© 2014-2015 Laslo Hunhold <dev at frign dot de> © 2014-2015 Laslo Hunhold <dev at frign dot de>

View file

@ -1,60 +1,57 @@
# st - simple terminal # st - simple terminal
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
.POSIX:
include config.mk include config.mk
SRC = st.c SRC = st.c x.c
OBJ = ${SRC:.c=.o} OBJ = $(SRC:.c=.o)
all: options st all: options st
options: options:
@echo st build options: @echo st build options:
@echo "CFLAGS = ${CFLAGS}" @echo "CFLAGS = $(STCFLAGS)"
@echo "LDFLAGS = ${LDFLAGS}" @echo "LDFLAGS = $(STLDFLAGS)"
@echo "CC = ${CC}" @echo "CC = $(CC)"
config.h: config.h:
cp config.def.h config.h cp config.def.h config.h
.c.o: .c.o:
@echo CC $< $(CC) $(STCFLAGS) -c $<
@${CC} -c ${CFLAGS} $<
${OBJ}: config.h config.mk st.o: config.h st.h win.h
x.o: arg.h st.h win.h
st: ${OBJ} $(OBJ): config.h config.mk
@echo CC -o $@
@${CC} -o $@ ${OBJ} ${LDFLAGS} st: $(OBJ)
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
clean: clean:
@echo cleaning rm -f st $(OBJ) st-$(VERSION).tar.gz
@rm -f config.h st ${OBJ} st-${VERSION}.tar.gz
dist: clean dist: clean
@echo creating dist tarball mkdir -p st-$(VERSION)
@mkdir -p st-${VERSION} cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
@cp -R LICENSE Makefile README config.mk config.def.h st.info st.1 arg.h ${SRC} st-${VERSION} config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
@tar -cf st-${VERSION}.tar st-${VERSION} st-$(VERSION)
@gzip st-${VERSION}.tar tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
@rm -rf st-${VERSION} rm -rf st-$(VERSION)
install: all install: st
@echo installing executable file to ${DESTDIR}${PREFIX}/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin cp -f st $(DESTDIR)$(PREFIX)/bin
@cp -f st ${DESTDIR}${PREFIX}/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/st
@chmod 755 ${DESTDIR}${PREFIX}/bin/st mkdir -p $(DESTDIR)$(MANPREFIX)/man1
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
@sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 tic -sx st.info
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1
@echo Please see the README file regarding the terminfo entry of st. @echo Please see the README file regarding the terminfo entry of st.
@tic -sx st.info
uninstall: uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin rm -f $(DESTDIR)$(PREFIX)/bin/st
@rm -f ${DESTDIR}${PREFIX}/bin/st rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/st.1
.PHONY: all options clean dist install uninstall .PHONY: all options clean dist install uninstall

View file

@ -4,18 +4,18 @@ Forked from [https://github.com/shiva/st](https://github.com/shiva/st) for simpl
+ transparency + transparency
+ copy to clipboard + copy to clipboard
+ solarized colors (light and dark toggleable) + ~~Solarized colors (light and dark toggleable)~~ (Change to your own colors, see no value of toggle)
+ vertcenter + vertcenter
+ scrollback with keyboard + scrollback with keyboard
+ scrollback with mouse + scrollback with mouse
+ updated to latest version 0.8.1
## My own additions ## My own additions
+ Default font is system "mono" at 14pt + Default font is system "mono" at 14pt
+ Fixed transparency patch (see below for installation)
+ Toggle light/dark mode now Alt-Tab instead of the frequently conflicting F6
+ Alt-k and Alt-j scroll back/foward in history one line at a time + Alt-k and Alt-j scroll back/foward in history one line at a time
+ Alt-u and Alt-d scroll back/foward in history a page at a time + Alt-u and Alt-d scroll back/foward in history a page at a time
+ Applied colors, insipred by Pop! OS colors.
## Terminal-specific mappings ## Terminal-specific mappings
@ -28,20 +28,23 @@ Forked from [https://github.com/shiva/st](https://github.com/shiva/st) for simpl
## Installation for newbs ## Installation for newbs
## Requirements for build
Install `base-devel` - compiler and stuff (most distros have).
Install code depndencies (voidlinux - most distro should have something similar)
+ `fontconfig-devel`
+ `libX11-devel`
+ `libXft-devel`
``` ```
make make
sudo make install sudo make install
``` ```
### Solarized mode ## Custom changes (`config.def.h` or `config.h`)
The terminal is now transparent by default, if you want non-transparent solarized colors, run the following: + change `alpha`
+ chnage colors in `colorname` added comments with numbers `0`-`15` colors and also `bg`, `fg` and `cursor` color.
```
make clean
patch -R < patches/transparency.diff
make
sudo make install
```
You can change the transparency value by changing the `alpha` variable in the `config.h` file.

22
arg.h
View file

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

View file

@ -5,7 +5,7 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char font[] = "mono:pixelsize=14:antialias=true:autohint=true"; static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2; static int borderpx = 2;
/* /*
@ -16,12 +16,12 @@ static int borderpx = 2;
* 4: value of shell in /etc/passwd * 4: value of shell in /etc/passwd
* 5: value of shell in config.h * 5: value of shell in config.h
*/ */
static char shell[] = "/bin/sh"; static char *shell = "/bin/sh";
static char *utmp = NULL; char *utmp = NULL;
static char stty_args[] = "stty raw pass8 nl -echo -iexten -cstopb 38400"; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */ /* identification sequence returned in DA and DECID */
static char vtiden[] = "\033[?6c"; char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */ /* Kerning / character bounding-box multipliers */
static float cwscale = 1.0; static float cwscale = 1.0;
@ -32,14 +32,14 @@ static float chscale = 1.0;
* *
* More advanced example: " `'\"()[]{}" * More advanced example: " `'\"()[]{}"
*/ */
static char worddelimiters[] = " "; char *worddelimiters = " ";
/* selection timeouts (in milliseconds) */ /* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300; static unsigned int doubleclicktimeout = 300;
static unsigned int tripleclicktimeout = 600; static unsigned int tripleclicktimeout = 600;
/* alt screens */ /* alt screens */
static int allowaltscreen = 1; int allowaltscreen = 1;
/* frames per second st should at maximum draw to the screen */ /* frames per second st should at maximum draw to the screen */
static unsigned int xfps = 120; static unsigned int xfps = 120;
@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2;
static int bellvolume = 0; static int bellvolume = 0;
/* default TERM value */ /* default TERM value */
static char termname[] = "st-256color"; char *termname = "st-256color";
/* /*
* spaces per tab * spaces per tab
@ -80,63 +80,49 @@ static char termname[] = "st-256color";
* *
* stty tabs * stty tabs
*/ */
static unsigned int tabspaces = 8; unsigned int tabspaces = 8;
/* bg opacity */ /* bg opacity */
static const int alpha = 0xdd; unsigned int alpha = 0xcd;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* solarized dark */ /* 8 normal colors */
"#073642", /* 0: black */
"#dc322f", /* 1: red */
"#859900", /* 2: green */
"#b58900", /* 3: yellow */
"#268bd2", /* 4: blue */
"#d33682", /* 5: magenta */
"#2aa198", /* 6: cyan */
"#eee8d5", /* 7: white */
"#002b36", /* 8: brblack */
"#cb4b16", /* 9: brred */
"#586e75", /* 10: brgreen */
"#657b83", /* 11: bryellow */
"#839496", /* 12: brblue */
"#6c71c4", /* 13: brmagenta*/
"#93a1a1", /* 14: brcyan */
"#fdf6e3", /* 15: brwhite */
"black", "black",
"red3",
"green3",
"yellow3",
"blue2",
"magenta3",
"cyan3",
"gray90",
/* 8 bright colors */
"gray50",
"red",
"green",
"yellow",
"#5c5cff",
"magenta",
"cyan",
"white",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
}; };
/* Terminal colors for alternate (light) palette */
static const char *altcolorname[] = {
/* solarized light */
"#eee8d5", /* 0: black */
"#dc322f", /* 1: red */
"#859900", /* 2: green */
"#b58900", /* 3: yellow */
"#268bd2", /* 4: blue */
"#d33682", /* 5: magenta */
"#2aa198", /* 6: cyan */
"#073642", /* 7: white */
"#fdf6e3", /* 8: brblack */
"#cb4b16", /* 9: brred */
"#93a1a1", /* 10: brgreen */
"#839496", /* 11: bryellow */
"#657b83", /* 12: brblue */
"#6c71c4", /* 13: brmagenta*/
"#586e75", /* 14: brcyan */
"#002b36", /* 15: brwhite */
"black",
};
/* /*
* Default colors (colorname index) * Default colors (colorname index)
* foreground, background, cursor, reverse cursor * foreground, background, cursor, reverse cursor
*/ */
static unsigned int defaultfg = 12; unsigned int defaultfg = 7;
static unsigned int defaultbg = 257; unsigned int defaultbg = 0;
static unsigned int defaultcs = 14; static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 15; static unsigned int defaultrcs = 257;
/* /*
* Default shape of cursor * Default shape of cursor
@ -177,7 +163,7 @@ static MouseShortcut mshortcuts[] = {
{ Button5, XK_NO_MOD, "\005" }, { Button5, XK_NO_MOD, "\005" },
}; };
static MouseKey mkeys[] = { MouseKey mkeys[] = {
/* button mask function argument */ /* button mask function argument */
{ Button4, ShiftMask, kscrollup, {.i = 1} }, { Button4, ShiftMask, kscrollup, {.i = 1} },
{ Button5, ShiftMask, kscrolldown, {.i = 1} }, { Button5, ShiftMask, kscrolldown, {.i = 1} },
@ -185,6 +171,7 @@ static MouseKey mkeys[] = {
/* Internal keyboard shortcuts. */ /* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = { static Shortcut shortcuts[] = {
/* mask keysym function argument */ /* mask keysym function argument */
@ -192,22 +179,16 @@ static Shortcut shortcuts[] = {
{ ControlMask, XK_Print, toggleprinter, {.i = 0} }, { ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} }, { ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} }, { TERMMOD, XK_Prior, zoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} }, { TERMMOD, XK_Next, zoom, {.f = -1} },
{ MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} }, { TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} },
{ MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_Y, selpaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} }, { TERMMOD, XK_I, iso14755, {.i = 0} },
{ MODKEY, XK_Control_L, iso14755, {.i = 0} },
{ MODKEY, XK_Tab, swapcolors, {.i = 0} },
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
{ MODKEY, XK_k, kscrollup, {.i = 1} },
{ MODKEY, XK_j, kscrolldown, {.i = 1} },
{ MODKEY, XK_u, kscrollup, {.i = -1} },
{ MODKEY, XK_d, kscrolldown, {.i = -1} },
}; };
/* /*
@ -259,219 +240,216 @@ static uint forceselmod = ShiftMask;
* world. Please decide about changes wisely. * world. Please decide about changes wisely.
*/ */
static Key key[] = { static Key key[] = {
/* keysym mask string appkey appcursor crlf */ /* keysym mask string appkey appcursor */
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1, 0}, { XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, { XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1, 0}, { XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1, 0}, { XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0, 0}, { XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1, 0}, { XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1, 0}, { XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0, 0}, { XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1, 0}, { XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1, 0}, { XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0, 0}, { XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1, 0}, { XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1, 0}, { XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0, 0}, { XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1, 0}, { XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1, 0}, { XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0, 0}, { XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0, 0}, { XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0, 0}, { XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
{ XK_KP_End, ControlMask, "\033[J", -1, 0, 0}, { XK_KP_End, ControlMask, "\033[J", -1, 0},
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0, 0}, { XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_KP_End, ShiftMask, "\033[K", -1, 0, 0}, { XK_KP_End, ShiftMask, "\033[K", -1, 0},
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0, 0}, { XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0, 0}, { XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0, 0}, { XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0, 0}, { XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0, 0}, { XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0, 0}, { XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0, 0}, { XK_KP_Insert, ControlMask, "\033[L", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0, 0}, { XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0, 0}, { XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0, 0}, { XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0, 0}, { XK_KP_Delete, ControlMask, "\033[M", -1, 0},
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0, 0}, { XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0, 0}, { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0, 0}, { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0, 0}, { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0, 0}, { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0, -1}, { XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\r\n", -1, 0, +1}, { XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0, 0}, { XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0, 0}, { XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0, 0}, { XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0, 0}, { XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0, 0}, { XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0, 0}, { XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0, 0}, { XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0, 0}, { XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0, 0}, { XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0, 0}, { XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0, 0}, { XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0, 0}, { XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0, 0}, { XK_Up, ShiftMask, "\033[1;2A", 0, 0},
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0, 0}, { XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0, 0}, { XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0, 0}, { XK_Up, ControlMask, "\033[1;5A", 0, 0},
{ XK_Up, ControlMask, "\033[1;5A", 0, 0, 0}, { XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0, 0}, { XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0, 0}, { XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0, 0}, { XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1, 0}, { XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1, 0}, { XK_Down, ShiftMask, "\033[1;2B", 0, 0},
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0, 0}, { XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0, 0}, { XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0, 0}, { XK_Down, ControlMask, "\033[1;5B", 0, 0},
{ XK_Down, ControlMask, "\033[1;5B", 0, 0, 0}, { XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0, 0}, { XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0, 0}, { XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0, 0}, { XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1, 0}, { XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1, 0}, { XK_Left, ShiftMask, "\033[1;2D", 0, 0},
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0, 0}, { XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0, 0}, { XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0, 0}, { XK_Left, ControlMask, "\033[1;5D", 0, 0},
{ XK_Left, ControlMask, "\033[1;5D", 0, 0, 0}, { XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0, 0}, { XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0, 0}, { XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0, 0}, { XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1, 0}, { XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1, 0}, { XK_Right, ShiftMask, "\033[1;2C", 0, 0},
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0, 0}, { XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0, 0}, { XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0, 0}, { XK_Right, ControlMask, "\033[1;5C", 0, 0},
{ XK_Right, ControlMask, "\033[1;5C", 0, 0, 0}, { XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0, 0}, { XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0, 0}, { XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0, 0}, { XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1, 0}, { XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1, 0}, { XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0, 0}, { XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0, -1}, { XK_Return, XK_ANY_MOD, "\r", 0, 0},
{ XK_Return, Mod1Mask, "\033\r\n", 0, 0, +1}, { XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0, -1}, { XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Return, XK_ANY_MOD, "\r\n", 0, 0, +1}, { XK_Insert, ControlMask, "\033[L", -1, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0, 0}, { XK_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0, 0}, { XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0, 0}, { XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0, 0}, { XK_Delete, ControlMask, "\033[M", -1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0, 0}, { XK_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0, 0}, { XK_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_Delete, ControlMask, "\033[M", -1, 0, 0}, { XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0, 0}, { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_Delete, ShiftMask, "\033[2K", -1, 0, 0}, { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, { XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, { XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, { XK_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0, 0}, { XK_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0, 0}, { XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_Home, ShiftMask, "\033[2J", 0, -1, 0}, { XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, { XK_End, ControlMask, "\033[J", -1, 0},
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1, 0}, { XK_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1, 0}, { XK_End, ShiftMask, "\033[K", -1, 0},
{ XK_End, ControlMask, "\033[J", -1, 0, 0}, { XK_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_End, ControlMask, "\033[1;5F", +1, 0, 0}, { XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_End, ShiftMask, "\033[K", -1, 0, 0}, { XK_Prior, ControlMask, "\033[5;5~", 0, 0},
{ XK_End, ShiftMask, "\033[1;2F", +1, 0, 0}, { XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0, 0}, { XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0, 0}, { XK_Next, ControlMask, "\033[6;5~", 0, 0},
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0, 0}, { XK_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0, 0}, { XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_Next, ControlMask, "\033[6;5~", 0, 0, 0}, { XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0, 0}, { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0, 0}, { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0, 0}, { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0, 0}, { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0, 0}, { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0, 0}, { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0, 0}, { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0, 0}, { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0, 0}, { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0, 0}, { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0, 0}, { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0, 0}, { XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0, 0}, { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0, 0}, { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0, 0}, { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0, 0}, { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0, 0}, { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0, 0}, { XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0, 0}, { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0, 0}, { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0, 0}, { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0, 0}, { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0, 0}, { XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0, 0}, { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0, 0}, { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0, 0}, { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0, 0}, { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0, 0}, { XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0, 0}, { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0, 0}, { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0, 0}, { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0, 0}, { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0, 0}, { XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0, 0}, { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0, 0}, { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0, 0}, { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0, 0}, { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0, 0}, { XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0, 0}, { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0, 0}, { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0, 0}, { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0, 0}, { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0, 0}, { XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0, 0}, { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0, 0}, { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0, 0}, { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0, 0}, { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0, 0}, { XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0, 0}, { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0, 0}, { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0, 0}, { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0, 0}, { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0, 0}, { XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0, 0}, { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0, 0}, { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0, 0}, { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0, 0}, { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0, 0}, { XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0, 0}, { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0, 0}, { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0, 0}, { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0, 0}, { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0, 0}, { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0, 0}, { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0, 0}, { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0, 0}, { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0, 0}, { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0, 0}, { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0, 0}, { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0, 0}, { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0, 0}, { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0, 0}, { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0, 0}, { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0, 0}, { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0, 0}, { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0, 0}, { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0, 0}, { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0, 0}, { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0, 0}, { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0, 0}, { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0, 0}, { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0, 0}, { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0, 0}, { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0, 0}, { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0, 0}, { XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0, 0},
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0, 0},
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0, 0},
}; };
/* /*
@ -493,4 +471,3 @@ static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?" " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~"; "`abcdefghijklmnopqrstuvwxyz{|}~";

View file

@ -1,28 +1,28 @@
# st version # st version
VERSION = 0.7 VERSION = 0.8.1
# Customize below to fit your system # Customize below to fit your system
# paths # paths
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = $(PREFIX)/share/man
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# includes and libs # includes and libs
INCS = -I. -I/usr/include -I${X11INC} \ INCS = -I$(X11INC) \
`pkg-config --cflags fontconfig` \ `pkg-config --cflags fontconfig` \
`pkg-config --cflags freetype2` `pkg-config --cflags freetype2`
LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXext -lXft -lXrender\ LIBS = -L${X11LIB} -lm -lrt -lX11 -lutil -lXft -lXrender \
`pkg-config --libs fontconfig` \ `pkg-config --libs fontconfig` \
`pkg-config --libs freetype2` `pkg-config --libs freetype2`
# flags # flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600 CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
CFLAGS += -g -std=c99 -pedantic -Wall -Wvariadic-macros -Os ${INCS} ${CPPFLAGS} STCFLAGS = $(INCS) $(CPPFLAGS) $(CFLAGS)
LDFLAGS += -g ${LIBS} STLDFLAGS = $(LIBS) $(LDFLAGS)
# compiler and linker # compiler and linker
# CC = cc # CC = c99

183
patches/st-alpha-0.8.1.diff Normal file
View file

@ -0,0 +1,183 @@
diff --git a/config.def.h b/config.def.h
index feec7e2..e373018 100644
--- a/config.def.h
+++ b/config.def.h
@@ -82,6 +82,9 @@ char *termname = "st-256color";
*/
unsigned int tabspaces = 8;
+/* bg opacity */
+unsigned int alpha = 0xcd;
+
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
diff --git a/config.mk b/config.mk
index 039c42c..3b00d7e 100644
--- a/config.mk
+++ b/config.mk
@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
INCS = -I$(X11INC) \
`pkg-config --cflags fontconfig` \
`pkg-config --cflags freetype2`
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
+LIBS = -L${X11LIB} -lm -lrt -lX11 -lutil -lXft -lXrender \
`pkg-config --libs fontconfig` \
`pkg-config --libs freetype2`
diff --git a/st.h b/st.h
index cdd25ae..850c5f0 100644
--- a/st.h
+++ b/st.h
@@ -134,6 +134,7 @@ extern char *worddelimiters;
extern int allowaltscreen;
extern char *termname;
extern unsigned int tabspaces;
+extern unsigned int alpha;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern MouseKey mkeys[];
diff --git a/win.h b/win.h
index 31f327d..d277477 100644
--- a/win.h
+++ b/win.h
@@ -23,6 +23,10 @@ enum win_mode {
|MODE_MOUSEMANY,
};
+/* alpha */
+#define OPAQUE 0Xff
+#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL)
+
void xbell(void);
void xclipcopy(void);
void xdrawcursor(int, int, Glyph, int, int, Glyph);
diff --git a/x.c b/x.c
index f4a6be7..840d2fa 100644
--- a/x.c
+++ b/x.c
@@ -99,6 +99,7 @@ typedef struct {
XSetWindowAttributes attrs;
int scr;
int isfixed; /* is fixed geometry? */
+ int depth; /* bit depth */
int l, t; /* left and top offset */
int gm; /* geometry mask */
} XWindow;
@@ -698,7 +699,7 @@ xresize(int col, int row)
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- DefaultDepth(xw.dpy, xw.scr));
+ xw.depth);
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
@@ -758,6 +759,13 @@ xloadcols(void)
else
die("Could not allocate color %d\n", i);
}
+
+ /* set alpha value of bg color */
+ if (USE_ARGB) {
+ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE;
+ dc.col[defaultbg].pixel &= 0x00111111;
+ dc.col[defaultbg].pixel |= alpha << 24;
+ }
loaded = 1;
}
@@ -779,6 +787,17 @@ xsetcolorname(int x, const char *name)
return 0;
}
+void
+xtermclear(int col1, int row1, int col2, int row2)
+{
+ XftDrawRect(xw.draw,
+ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
+ borderpx + col1 * win.cw,
+ borderpx + row1 * win.ch,
+ (col2-col1+1) * win.cw,
+ (row2-row1+1) * win.ch);
+}
+
/*
* Absolute coordinates.
*/
@@ -1018,7 +1037,40 @@ xinit(int cols, int rows)
if (!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr);
+ if (!USE_ARGB)
+ xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+ else {
+ XVisualInfo *vis;
+ XRenderPictFormat *fmt;
+ int nvi;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = xw.scr,
+ .depth = 32,
+ .class = TrueColor
+ };
+
+ vis = XGetVisualInfo(xw.dpy,
+ VisualScreenMask | VisualDepthMask | VisualClassMask,
+ &tpl, &nvi);
+ xw.vis = NULL;
+ for (i = 0; i < nvi; i++) {
+ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ xw.vis = vis[i].visual;
+ break;
+ }
+ }
+
+ XFree(vis);
+
+ if (!xw.vis) {
+ fprintf(stderr, "Couldn't find ARGB visual.\n");
+ exit(1);
+ }
+ }
/* font */
if (!FcInit())
@@ -1028,7 +1080,11 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0);
/* colors */
- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
+ if (!USE_ARGB)
+ xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
+ else
+ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr),
+ xw.vis, None);
xloadcols();
/* adjust fixed window geometry */
@@ -1051,16 +1107,15 @@ xinit(int cols, int rows)
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
parent = XRootWindow(xw.dpy, xw.scr);
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
+ win.w, win.h, 0, xw.depth, InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
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, xw.depth);
+ dc.gc = XCreateGC(xw.dpy, (USE_ARGB) ? xw.buf: parent,
+ GCGraphicsExposures, &gcvalues);
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);

View file

@ -1,13 +0,0 @@
diff --git a/st.c b/st.c
index 2594c65..ebdde9f 100644
--- a/st.c
+++ b/st.c
@@ -1263,6 +1263,8 @@ xsetsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear(0);
+
+ clipcopy(NULL);
}
void

View file

@ -0,0 +1,13 @@
diff --git a/x.c b/x.c
index 13fa9f4..88fd341 100644
--- a/x.c
+++ b/x.c
@@ -624,6 +624,8 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+
+ xclipcopy();
}
void

View file

@ -0,0 +1,25 @@
From e0a92b498278e42e33f8007fd7b622a05e5310eb Mon Sep 17 00:00:00 2001
From: Linh Nguyen <linhvng.2212@gmail.com>
Date: Wed, 28 Mar 2018 12:23:45 -0400
Subject: [PATCH] port st-no_bold_colors patch to 0.8.1
---
x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x.c b/x.c
index c343ba2..42e7e9f 100644
--- a/x.c
+++ b/x.c
@@ -1295,7 +1295,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
/* Change basic system colors [0-7] to bright system colors [8-15] */
if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
- fg = &dc.col[base.fg + 8];
+ fg = &dc.col[base.fg];
if (IS_SET(MODE_REVERSE)) {
if (fg == &dc.col[defaultfg]) {
--
2.16.3

View file

@ -1,13 +0,0 @@
diff --git a/st.c b/st.c
index 2594c65..f6fe717 100644
--- a/st.c
+++ b/st.c
@@ -3719,7 +3719,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
/* Change basic system colors [0-7] to bright system colors [8-15] */
if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
- fg = &dc.col[base.fg + 8];
+ fg = &dc.col[base.fg];
if (IS_SET(MODE_REVERSE)) {
if (fg == &dc.col[defaultfg]) {

View file

@ -1,68 +1,42 @@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a719e36..9b51988 100644 index 82b1b09..27d42ca 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -178,6 +178,8 @@ static Shortcut shortcuts[] = { @@ -181,6 +181,8 @@ static Shortcut shortcuts[] = {
{ MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, { TERMMOD, XK_Y, selpaste, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ MODKEY, XK_Control_L, iso14755, {.i = 0} }, { TERMMOD, XK_I, iso14755, {.i = 0} },
+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, + { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, + { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
}; };
/* /*
diff --git a/st.c b/st.c diff --git a/st.c b/st.c
index fbcd9e0..64bc208 100644 index 65a0cb6..1d8c12a 100644
--- a/st.c --- a/st.c
+++ b/st.c +++ b/st.c
@@ -61,6 +61,7 @@ char *argv0; @@ -121,6 +121,9 @@ typedef struct {
#define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0
#define XK_SWITCH_MOD (1<<13)
+#define histsize 2000
/* macros */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -87,6 +88,8 @@ char *argv0;
#define TRUERED(x) (((x) & 0xff0000) >> 8)
#define TRUEGREEN(x) (((x) & 0xff00))
#define TRUEBLUE(x) (((x) & 0xff) << 8)
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \
+ + histsize + 1) % histsize] : term.line[(y) - term.scr])
/* constants */
#define ISO14755CMD "dmenu -w %lu -p codepoint: </dev/null"
@@ -241,6 +244,9 @@ typedef struct {
int col; /* nb col */ int col; /* nb col */
Line *line; /* screen */ Line *line; /* screen */
Line *alt; /* alternate screen */ Line *alt; /* alternate screen */
+ Line hist[histsize]; /* history buffer */ + Line hist[HISTSIZE]; /* history buffer */
+ int histi; /* history index */ + int histi; /* history index */
+ int scr; /* scroll back */ + int scr; /* scroll back */
int *dirty; /* dirtyness of lines */ int *dirty; /* dirtyness of lines */
XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */
TCursor c; /* cursor */ TCursor c; /* cursor */
@@ -334,6 +340,8 @@ typedef struct { int ocx; /* old cursor col */
/* function definitions used in config.h */ @@ -188,8 +191,8 @@ static void tnewline(int);
static void clipcopy(const Arg *); static void tputtab(int);
static void clippaste(const Arg *);
+static void kscrolldown(const Arg *);
+static void kscrollup(const Arg *);
static void numlock(const Arg *);
static void selpaste(const Arg *);
static void xzoom(const Arg *);
@@ -409,8 +417,8 @@ static void tputtab(int);
static void tputc(Rune); static void tputc(Rune);
static void treset(void); static void treset(void);
static void tresize(int, int);
-static void tscrollup(int, int); -static void tscrollup(int, int);
-static void tscrolldown(int, int); -static void tscrolldown(int, int);
+static void tscrollup(int, int, int); +static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int); +static void tscrolldown(int, int, int);
static void tsetattr(int *, int); static void tsetattr(int *, int);
static void tsetchar(Rune, Glyph *, int, int); static void tsetchar(Rune, Glyph *, int, int);
static void tsetscroll(int, int); static void tsetdirt(int, int);
@@ -742,10 +750,10 @@ tlinelen(int y) @@ -431,10 +434,10 @@ tlinelen(int y)
{ {
int i = term.col; int i = term.col;
@ -75,7 +49,7 @@ index fbcd9e0..64bc208 100644
--i; --i;
return i; return i;
@@ -807,7 +815,7 @@ selsnap(int *x, int *y, int direction) @@ -543,7 +546,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or * Snap around if the word wraps around at the end or
* beginning of a line. * beginning of a line.
*/ */
@ -84,7 +58,7 @@ index fbcd9e0..64bc208 100644
prevdelim = ISDELIM(prevgp->u); prevdelim = ISDELIM(prevgp->u);
for (;;) { for (;;) {
newx = *x + direction; newx = *x + direction;
@@ -822,14 +830,14 @@ selsnap(int *x, int *y, int direction) @@ -558,14 +561,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x; yt = *y, xt = *x;
else else
yt = newy, xt = newx; yt = newy, xt = newx;
@ -101,7 +75,7 @@ index fbcd9e0..64bc208 100644
delim = ISDELIM(gp->u); delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u))) || (delim && gp->u != prevgp->u)))
@@ -850,14 +858,14 @@ selsnap(int *x, int *y, int direction) @@ -586,14 +589,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1; *x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) { if (direction < 0) {
for (; *y > 0; *y += direction) { for (; *y > 0; *y += direction) {
@ -118,7 +92,7 @@ index fbcd9e0..64bc208 100644
& ATTR_WRAP)) { & ATTR_WRAP)) {
break; break;
} }
@@ -1023,13 +1031,13 @@ getsel(void) @@ -624,13 +627,13 @@ getsel(void)
} }
if (sel.type == SEL_RECTANGULAR) { if (sel.type == SEL_RECTANGULAR) {
@ -135,27 +109,27 @@ index fbcd9e0..64bc208 100644
while (last >= gp && last->u == ' ') while (last >= gp && last->u == ' ')
--last; --last;
@@ -1513,6 +1521,9 @@ ttyread(void) @@ -836,6 +839,9 @@ ttyread(void)
if (buflen > 0) if (buflen > 0)
memmove(buf, ptr, buflen); memmove(buf, buf + written, buflen);
+ if (term.scr > 0 && term.scr < histsize-1) + if (term.scr > 0 && term.scr < HISTSIZE-1)
+ term.scr++; + term.scr++;
+ +
return ret; return ret;
} }
@@ -1522,6 +1533,9 @@ ttywrite(const char *s, size_t n) @@ -843,6 +849,9 @@ void
fd_set wfd, rfd; ttywrite(const char *s, size_t n, int may_echo)
ssize_t r; {
size_t lim = 256; const char *next;
+ Arg arg = (Arg) { .i = term.scr }; + Arg arg = (Arg) { .i = term.scr };
+ +
+ kscrolldown(&arg); + kscrolldown(&arg);
/* if (may_echo && IS_SET(MODE_ECHO))
* Remember that we are using a pty, which might be a modem line. twrite(s, n, 1);
@@ -1724,13 +1738,53 @@ tswapscreen(void) @@ -1054,13 +1063,54 @@ tswapscreen(void)
} }
void void
@ -185,13 +159,14 @@ index fbcd9e0..64bc208 100644
+ if (n < 0) + if (n < 0)
+ n = term.row + n; + n = term.row + n;
+ +
+ if (term.scr <= histsize - n) { + if (term.scr <= HISTSIZE-n) {
+ term.scr += n; + term.scr += n;
+ selscroll(0, n); + selscroll(0, n);
+ tfulldirt(); + tfulldirt();
+ } + }
+} +}
+ +
+
+void +void
+tscrolldown(int orig, int n, int copyhist) +tscrolldown(int orig, int n, int copyhist)
{ {
@ -201,7 +176,7 @@ index fbcd9e0..64bc208 100644
LIMIT(n, 0, term.bot-orig+1); LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) { + if (copyhist) {
+ term.histi = (term.histi - 1 + histsize) % histsize; + term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
+ temp = term.hist[term.histi]; + temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[term.bot]; + term.hist[term.histi] = term.line[term.bot];
+ term.line[term.bot] = temp; + term.line[term.bot] = temp;
@ -210,7 +185,7 @@ index fbcd9e0..64bc208 100644
tsetdirt(orig, term.bot-n); tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot); tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1744,13 +1798,20 @@ tscrolldown(int orig, int n) @@ -1074,13 +1124,20 @@ tscrolldown(int orig, int n)
} }
void void
@ -223,7 +198,7 @@ index fbcd9e0..64bc208 100644
LIMIT(n, 0, term.bot-orig+1); LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) { + if (copyhist) {
+ term.histi = (term.histi + 1) % histsize; + term.histi = (term.histi + 1) % HISTSIZE;
+ temp = term.hist[term.histi]; + temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[orig]; + term.hist[term.histi] = term.line[orig];
+ term.line[orig] = temp; + term.line[orig] = temp;
@ -232,7 +207,7 @@ index fbcd9e0..64bc208 100644
tclearregion(0, orig, term.col-1, orig+n-1); tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot); tsetdirt(orig+n, term.bot);
@@ -1799,7 +1860,7 @@ tnewline(int first_col) @@ -1129,7 +1186,7 @@ tnewline(int first_col)
int y = term.c.y; int y = term.c.y;
if (y == term.bot) { if (y == term.bot) {
@ -241,7 +216,7 @@ index fbcd9e0..64bc208 100644
} else { } else {
y++; y++;
} }
@@ -1964,14 +2025,14 @@ void @@ -1294,14 +1351,14 @@ void
tinsertblankline(int n) tinsertblankline(int n)
{ {
if (BETWEEN(term.c.y, term.top, term.bot)) if (BETWEEN(term.c.y, term.top, term.bot))
@ -258,7 +233,7 @@ index fbcd9e0..64bc208 100644
} }
int32_t int32_t
@@ -2405,11 +2466,11 @@ csihandle(void) @@ -1730,11 +1787,11 @@ csihandle(void)
break; break;
case 'S': /* SU -- Scroll <n> line up */ case 'S': /* SU -- Scroll <n> line up */
DEFAULT(csiescseq.arg[0], 1); DEFAULT(csiescseq.arg[0], 1);
@ -272,7 +247,7 @@ index fbcd9e0..64bc208 100644
break; break;
case 'L': /* IL -- Insert <n> blank lines */ case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1); DEFAULT(csiescseq.arg[0], 1);
@@ -2945,7 +3006,7 @@ eschandle(uchar ascii) @@ -2258,7 +2315,7 @@ eschandle(uchar ascii)
return 0; return 0;
case 'D': /* IND -- Linefeed */ case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) { if (term.c.y == term.bot) {
@ -281,7 +256,7 @@ index fbcd9e0..64bc208 100644
} else { } else {
tmoveto(term.c.x, term.c.y+1); tmoveto(term.c.x, term.c.y+1);
} }
@@ -2958,7 +3019,7 @@ eschandle(uchar ascii) @@ -2271,7 +2328,7 @@ eschandle(uchar ascii)
break; break;
case 'M': /* RI -- Reverse index */ case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) { if (term.c.y == term.top) {
@ -290,7 +265,7 @@ index fbcd9e0..64bc208 100644
} else { } else {
tmoveto(term.c.x, term.c.y-1); tmoveto(term.c.x, term.c.y-1);
} }
@@ -3145,7 +3206,7 @@ check_control_code: @@ -2490,7 +2547,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void void
tresize(int col, int row) tresize(int col, int row)
{ {
@ -299,11 +274,12 @@ index fbcd9e0..64bc208 100644
int minrow = MIN(row, term.row); int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col); int mincol = MIN(col, term.col);
int *bp; int *bp;
@@ -3185,6 +3246,14 @@ tresize(int col, int row) @@ -2527,7 +2584,15 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
+ for (i = 0; i < histsize; i++) { - /* resize each row to new width, zero-pad if needed */
+ for (i = 0; i < HISTSIZE; i++) {
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); + term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
+ for (j = mincol; j < col; j++) { + for (j = mincol; j < col; j++) {
+ term.hist[i][j] = term.c.attr; + term.hist[i][j] = term.c.attr;
@ -311,31 +287,62 @@ index fbcd9e0..64bc208 100644
+ } + }
+ } + }
+ +
/* resize each row to new width, zero-pad if needed */ + /* resize each r w to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) { for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -4112,11 +4181,11 @@ drawregion(int x1, int y1, int x2, int y2) term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph));
@@ -2584,7 +2649,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0; term.dirty[y] = 0;
- xdrawline(term.line[y], x1, y, x2);
specs = term.specbuf; + xdrawline(TLINE(y), x1, y, x2);
- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y);
+ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y);
i = ox = 0;
for (x = x1; x < x2 && i < numspecs; x++) {
- new = term.line[y][x];
+ new = TLINE(y)[x];
if (new.mode == ATTR_WDUMMY)
continue;
if (ena_sel && selected(x, y))
@@ -4136,7 +4205,9 @@ drawregion(int x1, int y1, int x2, int y2)
if (i > 0)
xdrawglyphfontspecs(specs, base, i, ox, y);
} }
- xdrawcursor();
+
+ if (term.scr == 0)
+ xdrawcursor();
} }
void @@ -2605,8 +2670,10 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
+ if (term.scr == 0) {
+ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
+ }
term.ocx = cx, term.ocy = term.c.y;
xfinishdraw();
}
diff --git a/st.h b/st.h
index dac64d8..628e876 100644
--- a/st.h
+++ b/st.h
@@ -3,6 +3,9 @@
#include <stdint.h>
#include <sys/types.h>
+/* Arbitrary size */
+#define HISTSIZE 2000
+
/* macros */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
@@ -19,6 +22,8 @@
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
#define IS_TRUECOL(x) (1 << 24 & (x))
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \
+ + HISTSIZE + 1) % HISTSIZE] : term.line[(y) - term.scr])
enum glyph_attribute {
ATTR_NULL = 0,
@@ -111,6 +116,9 @@ void *xmalloc(size_t);
void *xrealloc(void *, size_t);
char *xstrdup(char *);
+void kscrolldown(const Arg *);
+void kscrollup(const Arg *);
+
/* config.h globals */
extern char *utmp;
extern char *stty_args;

View file

@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index eae969e..34ebb44 100644 index 27d42ca..feec7e2 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -152,8 +152,14 @@ static unsigned int defaultunderline = 7; @@ -156,8 +156,14 @@ static unsigned int defaultattr = 11;
*/ */
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* button mask string */ /* button mask string */
@ -12,18 +12,18 @@ index eae969e..34ebb44 100644
+ { Button5, XK_NO_MOD, "\005" }, + { Button5, XK_NO_MOD, "\005" },
+}; +};
+ +
+static MouseKey mkeys[] = { +MouseKey mkeys[] = {
+ /* button mask function argument */ + /* button mask function argument */
+ { Button4, ShiftMask, kscrollup, {.i = 1} }, + { Button4, ShiftMask, kscrollup, {.i = 1} },
+ { Button5, ShiftMask, kscrolldown, {.i = 1} }, + { Button5, ShiftMask, kscrolldown, {.i = 1} },
}; };
/* Internal keyboard shortcuts. */ /* Internal keyboard shortcuts. */
diff --git a/st.c b/st.c diff --git a/st.h b/st.h
index 233d301..c71b6e7 100644 index 628e876..cdd25ae 100644
--- a/st.c --- a/st.h
+++ b/st.c +++ b/st.h
@@ -299,6 +299,13 @@ typedef union { @@ -81,6 +81,13 @@ typedef union {
const void *v; const void *v;
} Arg; } Arg;
@ -34,18 +34,27 @@ index 233d301..c71b6e7 100644
+ const Arg arg; + const Arg arg;
+} MouseKey; +} MouseKey;
+ +
typedef struct { void die(const char *, ...);
uint mod; void redraw(void);
KeySym keysym; void draw(void);
@@ -953,6 +960,7 @@ bpress(XEvent *e) @@ -129,3 +136,4 @@ extern char *termname;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
+extern MouseKey mkeys[];
diff --git a/x.c b/x.c
index d43a529..754d859 100644
--- a/x.c
+++ b/x.c
@@ -409,6 +409,7 @@ bpress(XEvent *e)
{ {
struct timespec now; struct timespec now;
MouseShortcut *ms; MouseShortcut *ms;
+ MouseKey *mk; + MouseKey *mk;
int snap;
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
mousereport(e); @@ -424,6 +425,14 @@ bpress(XEvent *e)
@@ -967,6 +975,14 @@ bpress(XEvent *e)
} }
} }
@ -58,5 +67,5 @@ index 233d301..c71b6e7 100644
+ } + }
+ +
if (e->xbutton.button == Button1) { if (e->xbutton.button == Button1) {
clock_gettime(CLOCK_MONOTONIC, &now); /*
* If the user clicks below predefined timeouts specific

View file

@ -1,189 +0,0 @@
diff --git a/config.def.h b/config.def.h
index b41747f..adaa9b8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -84,42 +84,54 @@ static unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
- /* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
-
- /* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
-
- [255] = 0,
-
- /* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
+ /* solarized dark */
+ "#073642", /* 0: black */
+ "#dc322f", /* 1: red */
+ "#859900", /* 2: green */
+ "#b58900", /* 3: yellow */
+ "#268bd2", /* 4: blue */
+ "#d33682", /* 5: magenta */
+ "#2aa198", /* 6: cyan */
+ "#eee8d5", /* 7: white */
+ "#002b36", /* 8: brblack */
+ "#cb4b16", /* 9: brred */
+ "#586e75", /* 10: brgreen */
+ "#657b83", /* 11: bryellow */
+ "#839496", /* 12: brblue */
+ "#6c71c4", /* 13: brmagenta*/
+ "#93a1a1", /* 14: brcyan */
+ "#fdf6e3", /* 15: brwhite */
};
+/* Terminal colors for alternate (light) palette */
+static const char *altcolorname[] = {
+ /* solarized light */
+ "#eee8d5", /* 0: black */
+ "#dc322f", /* 1: red */
+ "#859900", /* 2: green */
+ "#b58900", /* 3: yellow */
+ "#268bd2", /* 4: blue */
+ "#d33682", /* 5: magenta */
+ "#2aa198", /* 6: cyan */
+ "#073642", /* 7: white */
+ "#fdf6e3", /* 8: brblack */
+ "#cb4b16", /* 9: brred */
+ "#93a1a1", /* 10: brgreen */
+ "#839496", /* 11: bryellow */
+ "#657b83", /* 12: brblue */
+ "#6c71c4", /* 13: brmagenta*/
+ "#586e75", /* 14: brcyan */
+ "#002b36", /* 15: brwhite */
+};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
-static unsigned int defaultfg = 7;
-static unsigned int defaultbg = 0;
-static unsigned int defaultcs = 256;
-static unsigned int defaultrcs = 257;
+static unsigned int defaultfg = 12;
+static unsigned int defaultbg = 8;
+static unsigned int defaultcs = 14;
+static unsigned int defaultrcs = 15;
/*
* Default shape of cursor
@@ -172,6 +184,7 @@ static Shortcut shortcuts[] = {
{ MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
{ MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} },
+ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
};
/*
diff --git a/st.c b/st.c
index 2594c65..b4a3089 100644
--- a/st.c
+++ b/st.c
@@ -328,6 +328,7 @@ typedef struct {
static void clipcopy(const Arg *);
static void clippaste(const Arg *);
static void numlock(const Arg *);
+static void swapcolors(const Arg *);
static void selpaste(const Arg *);
static void xzoom(const Arg *);
static void xzoomabs(const Arg *);
@@ -355,7 +356,7 @@ typedef struct {
/* Drawing Context */
typedef struct {
- Color col[MAX(LEN(colorname), 256)];
+ Color col[MAX(MAX(LEN(colorname), LEN(altcolorname)), 256)];
Font font, bfont, ifont, ibfont;
GC gc;
} DC;
@@ -533,6 +534,8 @@ static char *opt_name = NULL;
static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */
+static int usealtcolors = 0; /* 1 to use alternate palette */
+
static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
@@ -3148,6 +3151,11 @@ sixd_to_16bit(int x)
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
}
+const char* getcolorname(int i)
+{
+ return (usealtcolors) ? altcolorname[i] : colorname[i];
+}
+
int
xloadcolor(int i, const char *name, Color *ncolor)
{
@@ -3166,7 +3174,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
return XftColorAllocValue(xw.dpy, xw.vis,
xw.cmap, &color, ncolor);
} else
- name = colorname[i];
+ name = getcolorname(i);
}
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
@@ -3186,8 +3194,8 @@ xloadcols(void)
for (i = 0; i < LEN(dc.col); i++)
if (!xloadcolor(i, NULL, &dc.col[i])) {
- if (colorname[i])
- die("Could not allocate color '%s'\n", colorname[i]);
+ if (getcolorname(i))
+ die("Could not allocate color '%s'\n", getcolorname(i));
else
die("Could not allocate color %d\n", i);
}
@@ -3514,13 +3522,13 @@ xinit(void)
cursor = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, cursor);
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
xmousefg.red = 0xffff;
xmousefg.green = 0xffff;
xmousefg.blue = 0xffff;
}
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
xmousebg.red = 0x0000;
xmousebg.green = 0x0000;
xmousebg.blue = 0x0000;
@@ -4074,6 +4082,14 @@ numlock(const Arg *dummy)
term.numlock ^= 1;
}
+void
+swapcolors(const Arg *dummy)
+{
+ usealtcolors = !usealtcolors;
+ xloadcols();
+ redraw();
+}
+
char*
kmap(KeySym k, uint state)
{

View file

@ -1,189 +0,0 @@
--- st/config.def.h 2018-01-19 12:48:07.280548253 -0700
+++ st-transparent/config.def.h 2018-01-19 13:15:25.443443692 -0700
@@ -82,6 +82,9 @@
*/
static unsigned int tabspaces = 8;
+/* bg opacity */
+static const int alpha = 0xdd;
+
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* solarized dark */
@@ -101,6 +104,7 @@
"#6c71c4", /* 13: brmagenta*/
"#93a1a1", /* 14: brcyan */
"#fdf6e3", /* 15: brwhite */
+ "black",
};
/* Terminal colors for alternate (light) palette */
@@ -122,6 +126,7 @@
"#6c71c4", /* 13: brmagenta*/
"#586e75", /* 14: brcyan */
"#002b36", /* 15: brwhite */
+ "black",
};
/*
@@ -129,7 +134,7 @@
* foreground, background, cursor, reverse cursor
*/
static unsigned int defaultfg = 12;
-static unsigned int defaultbg = 8;
+static unsigned int defaultbg = 257;
static unsigned int defaultcs = 14;
static unsigned int defaultrcs = 15;
--- st/config.mk 2018-01-17 23:51:03.804274540 -0700
+++ st-transparent/config.mk 2018-01-19 12:56:45.323928617 -0700
@@ -14,7 +14,7 @@
INCS = -I. -I/usr/include -I${X11INC} \
`pkg-config --cflags fontconfig` \
`pkg-config --cflags freetype2`
-LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \
+LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXext -lXft -lXrender\
`pkg-config --libs fontconfig` \
`pkg-config --libs freetype2`
--- st/st.c 2018-01-18 19:01:56.693663129 -0700
+++ st-transparent/st.c 2018-01-19 13:03:28.877184002 -0700
@@ -61,6 +61,7 @@
#define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0
#define XK_SWITCH_MOD (1<<13)
+#define OPAQUE 0Xff
#define histsize 2000
/* macros */
@@ -83,6 +84,8 @@
(t1.tv_nsec-t2.tv_nsec)/1E6)
#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
+#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL)
+
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
#define IS_TRUECOL(x) (1 << 24 & (x))
#define TRUERED(x) (((x) & 0xff0000) >> 8)
@@ -281,6 +284,7 @@
int w, h; /* window width and height */
int ch; /* char height */
int cw; /* char width */
+ int depth; /* bit depth */
int cyo; /* char y offset */
char state; /* focus, redraw, visible */
int cursor; /* cursor style */
@@ -3326,7 +3330,7 @@
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
- DefaultDepth(xw.dpy, xw.scr));
+ xw.depth);
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, xw.w, xw.h);
}
@@ -3385,6 +3389,14 @@
else
die("Could not allocate color %d\n", i);
}
+
+ /* set alpha value of bg color */
+ if (USE_ARGB) {
+ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE; //0xcccc;
+ dc.col[defaultbg].pixel &= 0x00111111;
+ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000;
+ }
+
loaded = 1;
}
@@ -3405,6 +3417,15 @@
return 0;
}
+void
+xtermclear(int col1, int row1, int col2, int row2) {
+ XftDrawRect(xw.draw,
+ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
+ borderpx + col1 * xw.cw,
+ borderpx + row1 * xw.ch,
+ (col2-col1+1) * xw.cw,
+ (row2-row1+1) * xw.ch);
+}
/*
* Absolute coordinates.
@@ -3677,7 +3698,38 @@
if (!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr);
+ if (! USE_ARGB)
+ xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+ else {
+ XVisualInfo *vis;
+ XRenderPictFormat *fmt;
+ int nvi;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = xw.scr,
+ .depth = 32,
+ .class = TrueColor
+ };
+
+ vis = XGetVisualInfo(xw.dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
+ xw.vis = NULL;
+ for(i = 0; i < nvi; i ++) {
+ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ xw.vis = vis[i].visual;
+ break;
+ }
+ }
+
+ XFree(vis);
+
+ if (! xw.vis) {
+ fprintf(stderr, "Couldn't find ARGB visual.\n");
+ exit(1);
+ }
+ }
/* font */
if (!FcInit())
@@ -3687,7 +3739,10 @@
xloadfonts(usedfont, 0);
/* colors */
- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
+ if (! USE_ARGB)
+ xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
+ else
+ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr), xw.vis, None);
xloadcols();
/* adjust fixed window geometry */
@@ -3710,16 +3765,17 @@
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
parent = XRootWindow(xw.dpy, xw.scr);
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
- xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
+ xw.w, xw.h, 0, xw.depth, InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;
- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, xw.depth);
+ dc.gc = XCreateGC(xw.dpy,
+ (USE_ARGB)? xw.buf: parent,
+ GCGraphicsExposures,
&gcvalues);
- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
- DefaultDepth(xw.dpy, xw.scr));
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);

8
run-patches.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
patch < patches/st-clipboard-20180309-c5ba9c0.diff
patch < patches/st-no_bold_colors-0.8.1.diff
patch < patches/st-scrollback-0.8.diff
patch < patches/st-scrollback-mouse-0.8.diff
patch < patches/st-vertcenter-20180320-6ac8c8a.diff
patch < patches/st-alpha-0.8.1.diff

5
st-remove.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
rm /usr/local/bin/st
rm /usr/local/share/man/man1/st.1
rm /usr/share/terminfo/s/st*

19
st.1
View file

@ -120,7 +120,7 @@ st executes
instead of the shell. If this is used it instead of the shell. If this is used it
.B must be the last option .B must be the last option
on the command line, as in xterm / rxvt. on the command line, as in xterm / rxvt.
This option is only intended for compability, This option is only intended for compatibility,
and all the remaining arguments are used as a command and all the remaining arguments are used as a command
even without it. even without it.
.SH SHORTCUTS .SH SHORTCUTS
@ -142,28 +142,25 @@ Print the full screen to the
Print the selection to the Print the selection to the
.I iofile. .I iofile.
.TP .TP
.B Alt-Shift-Page Up .B Ctrl-Shift-Page Up
Increase font size. Increase font size.
.TP .TP
.B Alt-Shift-Page Down .B Ctrl-Shift-Page Down
Decrease font size. Decrease font size.
.TP .TP
.B Alt-Shift-Home .B Ctrl-Shift-Home
Reset to default font size. Reset to default font size.
.TP .TP
.B Shift-Insert .B Ctrl-Shift-y
Paste from primary selection (middle mouse button). Paste from primary selection (middle mouse button).
.TP .TP
.B Alt-Shift-Insert .B Ctrl-Shift-c
Paste from clipboard selection.
.TP
.B Alt-Shift-c
Copy the selected text to the clipboard selection. Copy the selected text to the clipboard selection.
.TP .TP
.B Alt-Shift-v .B Ctrl-Shift-v
Paste from the clipboard selection. Paste from the clipboard selection.
.TP .TP
.B Alt-Ctrl .B Ctrl-Shift-i
Launch dmenu to enter a unicode codepoint and send the corresponding glyph Launch dmenu to enter a unicode codepoint and send the corresponding glyph
to st. to st.
.SH CUSTOMIZATION .SH CUSTOMIZATION

2706
st.c

File diff suppressed because it is too large Load diff

140
st.h Normal file
View file

@ -0,0 +1,140 @@
/* See LICENSE for license details. */
#include <stdint.h>
#include <sys/types.h>
/* Arbitrary size */
#define HISTSIZE 2000
/* macros */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define LEN(a) (sizeof(a) / sizeof(a)[0])
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
#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 MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
#define IS_TRUECOL(x) (1 << 24 & (x))
#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \
+ HISTSIZE + 1) % HISTSIZE] : term.line[(y) - term.scr])
enum glyph_attribute {
ATTR_NULL = 0,
ATTR_BOLD = 1 << 0,
ATTR_FAINT = 1 << 1,
ATTR_ITALIC = 1 << 2,
ATTR_UNDERLINE = 1 << 3,
ATTR_BLINK = 1 << 4,
ATTR_REVERSE = 1 << 5,
ATTR_INVISIBLE = 1 << 6,
ATTR_STRUCK = 1 << 7,
ATTR_WRAP = 1 << 8,
ATTR_WIDE = 1 << 9,
ATTR_WDUMMY = 1 << 10,
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
};
enum selection_mode {
SEL_IDLE = 0,
SEL_EMPTY = 1,
SEL_READY = 2
};
enum selection_type {
SEL_REGULAR = 1,
SEL_RECTANGULAR = 2
};
enum selection_snap {
SNAP_WORD = 1,
SNAP_LINE = 2
};
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned short ushort;
typedef uint_least32_t Rune;
#define Glyph Glyph_
typedef struct {
Rune u; /* character code */
ushort mode; /* attribute flags */
uint32_t fg; /* foreground */
uint32_t bg; /* background */
} Glyph;
typedef Glyph *Line;
typedef union {
int i;
uint ui;
float f;
const void *v;
} Arg;
typedef struct {
uint b;
uint mask;
void (*func)(const Arg *);
const Arg arg;
} MouseKey;
void die(const char *, ...);
void redraw(void);
void draw(void);
void iso14755(const Arg *);
void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);
void toggleprinter(const Arg *);
int tattrset(int);
void tnew(int, int);
void tresize(int, int);
void tsetdirtattr(int);
void ttyhangup(void);
int ttynew(char *, char *, char *, char **);
size_t ttyread(void);
void ttyresize(int, int);
void ttywrite(const char *, size_t, int);
void resettitle(void);
void selclear(void);
void selinit(void);
void selstart(int, int, int);
void selextend(int, int, int, int);
int selected(int, int);
char *getsel(void);
size_t utf8encode(Rune, char *);
void *xmalloc(size_t);
void *xrealloc(void *, size_t);
char *xstrdup(char *);
void kscrolldown(const Arg *);
void kscrollup(const Arg *);
/* config.h globals */
extern char *utmp;
extern char *stty_args;
extern char *vtiden;
extern char *worddelimiters;
extern int allowaltscreen;
extern char *termname;
extern unsigned int tabspaces;
extern unsigned int alpha;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern MouseKey mkeys[];

11
st.info
View file

@ -25,6 +25,7 @@ st| simpleterm,
cuu=\E[%p1%dA, cuu=\E[%p1%dA,
dch=\E[%p1%dP, dch=\E[%p1%dP,
dch1=\E[P, dch1=\E[P,
dim=\E[2m,
dl=\E[%p1%dM, dl=\E[%p1%dM,
dl1=\E[M, dl1=\E[M,
ech=\E[%p1%dX, ech=\E[%p1%dX,
@ -142,7 +143,6 @@ st| simpleterm,
khome=\E[1~, khome=\E[1~,
kil1=\E[2;5~, kil1=\E[2;5~,
krmir=\E[2;2~, krmir=\E[2;2~,
kich1=\E[2~,
knp=\E[6~, knp=\E[6~,
kmous=\E[M, kmous=\E[M,
kpp=\E[5~, kpp=\E[5~,
@ -185,16 +185,23 @@ st| simpleterm,
tsl=\E]0;, tsl=\E]0;,
xenl, xenl,
vpa=\E[%i%p1%dd, vpa=\E[%i%p1%dd,
# Tmux unofficial extensions, see TERMINFO EXTENSIONS in tmux(1) # XTerm extensions
rmxx=\E[29m,
smxx=\E[9m,
# tmux extensions, see TERMINFO EXTENSIONS in tmux(1)
Se, Se,
Ss, Ss,
Tc, Tc,
Ms=\E]52;%p1%s;%p2%s\007,
st-256color| simpleterm with 256 colors, st-256color| simpleterm with 256 colors,
use=st, use=st,
ccc,
colors#256, colors#256,
oc=\E]104\007,
pairs#32767, pairs#32767,
# Nicked from xterm-256color # Nicked from xterm-256color
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,

42
win.h Normal file
View file

@ -0,0 +1,42 @@
/* See LICENSE for license details. */
enum win_mode {
MODE_VISIBLE = 1 << 0,
MODE_FOCUSED = 1 << 1,
MODE_APPKEYPAD = 1 << 2,
MODE_MOUSEBTN = 1 << 3,
MODE_MOUSEMOTION = 1 << 4,
MODE_REVERSE = 1 << 5,
MODE_KBDLOCK = 1 << 6,
MODE_HIDE = 1 << 7,
MODE_APPCURSOR = 1 << 8,
MODE_MOUSESGR = 1 << 9,
MODE_8BIT = 1 << 10,
MODE_BLINK = 1 << 11,
MODE_FBLINK = 1 << 12,
MODE_FOCUS = 1 << 13,
MODE_MOUSEX10 = 1 << 14,
MODE_MOUSEMANY = 1 << 15,
MODE_BRCKTPASTE = 1 << 16,
MODE_NUMLOCK = 1 << 17,
MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
|MODE_MOUSEMANY,
};
/* alpha */
#define OPAQUE 0Xff
#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL)
void xbell(void);
void xclipcopy(void);
void xdrawcursor(int, int, Glyph, int, int, Glyph);
void xdrawline(Line, int, int, int);
void xfinishdraw(void);
void xloadcols(void);
int xsetcolorname(int, const char *);
void xsettitle(char *);
int xsetcursor(int);
void xsetmode(int, unsigned int);
void xsetpointermotion(int);
void xsetsel(char *);
int xstartdraw(void);

2020
x.c Normal file

File diff suppressed because it is too large Load diff