Compare commits

..

18 Commits

Author SHA1 Message Date
Ryan 0d46fd1fb8
chore: config tweaks 2024-07-13 17:22:46 -04:00
Ryan a937a99606
add externalpipe based commands 2023-09-19 19:07:51 -04:00
Ryan 683675c895
update basic settings
- Tweaks some default keybindings
- Removes some unused keybindings
- Configures XResources names to conform to my system
- Better scroll and zoom speeds
2023-09-19 19:01:58 -04:00
Ryan a65c371597
create config from default 2023-09-19 16:36:12 -04:00
Ryan 220a11be81
cleanup config.def.h
Few small tweaks to variable naming and such.
2023-09-19 15:43:55 -04:00
Ryan 63effe1949
make the zoomrate configurable
This commit makes the rate that st zooms configurable.
2023-09-19 15:21:40 -04:00
Ryan 3f35198a6b
apply external-pipe-eternal patch
Makes it work with scrollback.
2023-09-19 15:16:39 -04:00
Ryan 7d55b080c6
apply externalpipe patch 2023-09-19 15:16:19 -04:00
Ryan db4024676a
apply blinking_cursor patch
Tweak the Xresources loading to use the new variable.
2023-09-19 15:16:17 -04:00
Ryan 2c0192d5ed
apply xclearwin patch 2023-09-19 15:16:06 -04:00
Ryan efaf088ee3
apply scrollback-mouse-increment patch
Tweak the config to be a bit better organized.
2023-09-19 15:16:04 -04:00
Ryan 60f2672b8e
apply scrollback-mouse-altscreen patch
This makes the mouse wheel work for both normal scrolling and
altscreens such as less or vim.
2023-09-19 15:15:52 -04:00
Ryan bf74b02c6f
apply scrollback-mouse patch
Just updates the config, kinda unnecessary.
2023-09-19 15:15:25 -04:00
Ryan 5785c2bb7b
apply scrollback-reflow patch
This patch makes text reflow like a real terminal.
2023-09-19 15:15:06 -04:00
Ryan 191541012c
apply scrollback patch 2023-09-19 15:15:05 -04:00
Ryan f5f579ba16
apply xresources patch 2023-09-19 15:14:38 -04:00
Ryan a24deef995
apply dynamic-cursor-color patch
Makes the cursor match the underlying text. Very pretty.
2023-09-19 15:13:10 -04:00
Ryan 611b6dde7e
apply anysize patch
This patch causes the terminal to fill its window manager slot versus
snapping to a multiple of the character width/height.
2023-09-19 15:12:41 -04:00
7 changed files with 32 additions and 49 deletions

View File

@ -7,7 +7,13 @@ include config.mk
SRC = st.c x.c
OBJ = $(SRC:.c=.o)
all: st
all: options st
options:
@echo st build options:
@echo "CFLAGS = $(STCFLAGS)"
@echo "LDFLAGS = $(STLDFLAGS)"
@echo "CC = $(CC)"
config.h:
cp config.def.h config.h
@ -48,4 +54,4 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
.PHONY: all clean dist install uninstall
.PHONY: all options clean dist install uninstall

View File

@ -53,7 +53,7 @@ int allowwindowops = 0;
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
static double minlatency = 2;
static double minlatency = 8;
static double maxlatency = 33;
/*
@ -177,6 +177,16 @@ static unsigned int defaultattr = 11;
*/
static uint forcemousemod = ShiftMask;
/*
* The number of lines to scroll by.
*/
const unsigned int scrollrate = 1;
/*
* The rate to zoom in (adjust the font size).
*/
const unsigned int zoomrate = 1;
/*
* Xresources preferences to load at startup
*/
@ -213,16 +223,6 @@ ResourcePref resources[] = {
{ "chscale", FLOAT, &chscale },
};
/*
* The number of lines to scroll by.
*/
const unsigned int scrollrate = 1;
/*
* The rate to zoom in (adjust the font size).
*/
const unsigned int zoomrate = 1;
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.

View File

@ -185,7 +185,7 @@ const unsigned int scrollrate = 5;
/*
* The rate to zoom in (adjust the font size).
*/
const int zoomrate = 5;
const int zoomrate = 1;
/*
* Xresources preferences to load at startup
@ -220,9 +220,9 @@ ResourcePref resources[] = {
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ XK_NO_MOD, Button4, kscrollup, {.i = scrollrate}, 0, /* !alt */ -1 },
{ XK_NO_MOD, Button4, kscrollup, {.i = scrollrate}, 0, /* !alt */ -1 },
{ XK_NO_MOD, Button5, kscrolldown, {.i = scrollrate}, 0, /* !alt */ -1 },
{ ControlMask, Button4, zoom, {.f = zoomrate * +1} },
{ ControlMask, Button4, zoom, {.f = zoomrate * +1} },
{ ControlMask, Button5, zoom, {.f = zoomrate * -1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
@ -248,8 +248,6 @@ static Shortcut shortcuts[] = {
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ TERMMOD, XK_Up, zoom, {.f = +1 * zoomrate} },
{ TERMMOD, XK_Down, zoom, {.f = -1 * zoomrate} },
{ TERMMOD, XK_0, zoomreset, {.f = 0} },
{ TERMMOD, XK_parenright, zoomreset, {.f = 0} },
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} },

View File

@ -1,5 +1,5 @@
# st version
VERSION = 0.9.2
VERSION = 0.9
# Customize below to fit your system

14
st.c
View File

@ -1386,7 +1386,6 @@ csiparse(void)
{
char *p = csiescseq.buf, *np;
long int v;
int sep = ';'; /* colon or semi-colon, but not both */
csiescseq.narg = 0;
if (*p == '?') {
@ -1404,9 +1403,7 @@ csiparse(void)
v = -1;
csiescseq.arg[csiescseq.narg++] = v;
p = np;
if (sep == ';' && *p == ':')
sep = ':'; /* allow override to colon once */
if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
break;
p++;
}
@ -1897,7 +1894,7 @@ csihandle(void)
ttywrite(vtiden, strlen(vtiden), 0);
break;
case 'b': /* REP -- if last char is printable print it <n> more times */
LIMIT(csiescseq.arg[0], 1, 65535);
DEFAULT(csiescseq.arg[0], 1);
if (term.lastc)
while (csiescseq.arg[0]-- > 0)
tputc(term.lastc);
@ -1991,7 +1988,6 @@ csihandle(void)
}
break;
case 'S': /* SU -- Scroll <n> line up */
if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
/* xterm, urxvt, alacritty save this in history */
tscrollup(term.top, term.bot, csiescseq.arg[0], SCROLL_SAVEHIST);
@ -2642,7 +2638,6 @@ eschandle(uchar ascii)
treset();
resettitle();
xloadcols();
xsetmode(0, MODE_HIDE);
break;
case '=': /* DECPAM -- Application keypad */
xsetmode(1, MODE_APPKEYPAD);
@ -2791,10 +2786,7 @@ check_control_code:
}
if (term.c.x+width > term.col) {
if (IS_SET(MODE_WRAP))
tnewline(1);
else
tmoveto(term.col - width, term.c.y);
tnewline(1);
gp = &term.line[term.c.y][term.c.x];
}

View File

@ -184,10 +184,6 @@ st-mono| simpleterm monocolor,
# XTerm extensions
rmxx=\E[29m,
smxx=\E[9m,
BE=\E[?2004h,
BD=\E[?2004l,
PS=\E[200~,
PE=\E[201~,
# disabled rep for now: causes some issues with older ncurses versions.
# rep=%p1%c\E[%p2%{1}%-%db,
# tmux extensions, see TERMINFO EXTENSIONS in tmux(1)

21
x.c
View File

@ -839,7 +839,7 @@ xloadcols(void)
int
xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
{
if (!BETWEEN(x, 0, dc.collen - 1))
if (!BETWEEN(x, 0, dc.collen))
return 1;
*r = dc.col[x].color.red >> 8;
@ -854,7 +854,7 @@ xsetcolorname(int x, const char *name)
{
Color ncolor;
if (!BETWEEN(x, 0, dc.collen - 1))
if (!BETWEEN(x, 0, dc.collen))
return 1;
if (!xloadcolor(x, name, &ncolor))
@ -1158,7 +1158,7 @@ xinit(int cols, int rows)
{
XGCValues gcvalues;
Cursor cursor;
Window parent, root;
Window parent;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
@ -1193,19 +1193,16 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap;
root = XRootWindow(xw.dpy, xw.scr);
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
parent = root;
xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
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,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
if (parent != root)
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;
dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
&gcvalues);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
DefaultDepth(xw.dpy, xw.scr));
@ -1671,9 +1668,6 @@ xseticontitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
if (p[0] == '\0')
p = opt_title;
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop) != Success)
return;
@ -1688,9 +1682,6 @@ xsettitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
if (p[0] == '\0')
p = opt_title;
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop) != Success)
return;