Add support for scroll(1)
Scroll is a program that stores all the lines of its child and be used in st as a way of implementing scrollback. This solution is much better than implementing the scrollback in st itself because having a different program allows to use it in any other program without doing modifications to those programs.
This commit is contained in:
parent
2465559051
commit
2090981be3
4 changed files with 16 additions and 9 deletions
16
st.c
16
st.c
|
|
@ -726,7 +726,7 @@ die(const char *errstr, ...)
|
|||
void
|
||||
execsh(char *cmd, char **args)
|
||||
{
|
||||
char *sh, *prog;
|
||||
char *sh, *prog, *arg;
|
||||
const struct passwd *pw;
|
||||
|
||||
errno = 0;
|
||||
|
|
@ -740,12 +740,16 @@ execsh(char *cmd, char **args)
|
|||
if ((sh = getenv("SHELL")) == NULL)
|
||||
sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
|
||||
|
||||
if (args)
|
||||
if (args) {
|
||||
prog = args[0];
|
||||
else if (utmp)
|
||||
prog = utmp;
|
||||
else
|
||||
arg = NULL;
|
||||
} else if (scroll || utmp) {
|
||||
prog = scroll ? scroll : utmp;
|
||||
arg = scroll ? utmp : NULL;
|
||||
} else {
|
||||
prog = sh;
|
||||
arg = NULL;
|
||||
}
|
||||
DEFAULT(args, ((char *[]) {prog, NULL}));
|
||||
|
||||
unsetenv("COLUMNS");
|
||||
|
|
@ -2768,4 +2772,4 @@ redraw(void)
|
|||
draw();
|
||||
}
|
||||
|
||||
#include "patch/st_include.c"
|
||||
#include "patch/st_include.c"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue