add -p flag to st

This commit is contained in:
randomuser 2022-11-10 13:40:39 +00:00
parent 3b0804dde2
commit 71551993ee
2 changed files with 16 additions and 4 deletions

7
st.1
View File

@ -3,7 +3,7 @@
st \- simple terminal
.SH SYNOPSIS
.B st
.RB [ \-aiv ]
.RB [ \-aivp ]
.RB [ \-c
.IR class ]
.RB [ \-f
@ -27,7 +27,7 @@ st \- simple terminal
.RI [ arguments ...]]
.PP
.B st
.RB [ \-aiv ]
.RB [ \-aivp ]
.RB [ \-c
.IR class ]
.RB [ \-f
@ -81,6 +81,9 @@ writes all the I/O to
This feature is useful when recording st sessions. A value of "-" means
standard output.
.TP
.BI \-p
enters pixel-perfect mode, where -g requests specific pixels instead of characters
.TP
.BI \-T " title"
defines the window title (default 'st').
.TP

9
x.c
View File

@ -256,6 +256,7 @@ static char *opt_io = NULL;
static char *opt_line = NULL;
static char *opt_name = NULL;
static char *opt_title = NULL;
static int opt_pixel = 0;
static uint buttons; /* bit field of pressed buttons */
@ -1157,8 +1158,13 @@ xinit(int cols, int rows)
xloadcols();
/* adjust fixed window geometry */
if(!opt_pixel) {
win.w = 2 * borderpx + cols * win.cw;
win.h = 2 * borderpx + rows * win.ch;
} else {
win.w = cols;
win.h = rows;
}
if (xw.gm & XNegative)
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
if (xw.gm & YNegative)
@ -2092,6 +2098,9 @@ main(int argc, char *argv[])
case 'o':
opt_io = EARGF(usage());
break;
case 'p':
opt_pixel = 1;
break;
case 'l':
opt_line = EARGF(usage());
break;