From 71551993eee955e9084ac029107e9b59225944d2 Mon Sep 17 00:00:00 2001 From: randomuser Date: Thu, 10 Nov 2022 13:40:39 +0000 Subject: [PATCH] add -p flag to st --- st.1 | 7 +++++-- x.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/st.1 b/st.1 index 39120b4..1a81012 100644 --- a/st.1 +++ b/st.1 @@ -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 diff --git a/x.c b/x.c index 21b5d77..f097307 100644 --- a/x.c +++ b/x.c @@ -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 */ - win.w = 2 * borderpx + cols * win.cw; - win.h = 2 * borderpx + rows * win.ch; + 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;