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
|
@ -25,13 +25,14 @@ static int borderpx = 2;
|
||||||
/*
|
/*
|
||||||
* What program is execed by st depends of these precedence rules:
|
* What program is execed by st depends of these precedence rules:
|
||||||
* 1: program passed with -e
|
* 1: program passed with -e
|
||||||
* 2: utmp option
|
* 2: scroll and/or utmp
|
||||||
* 3: SHELL environment variable
|
* 3: SHELL environment variable
|
||||||
* 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";
|
||||||
char *utmp = NULL;
|
char *utmp = NULL;
|
||||||
|
char *scroll = NULL;
|
||||||
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 */
|
||||||
|
|
3
st.1
3
st.1
|
@ -170,7 +170,8 @@ See the LICENSE file for the terms of redistribution.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR tabbed (1),
|
.BR tabbed (1),
|
||||||
.BR utmp (1),
|
.BR utmp (1),
|
||||||
.BR stty (1)
|
.BR stty (1),
|
||||||
|
.BR scroll (1)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
See the TODO file in the distribution.
|
See the TODO file in the distribution.
|
||||||
|
|
||||||
|
|
14
st.c
14
st.c
|
@ -726,7 +726,7 @@ die(const char *errstr, ...)
|
||||||
void
|
void
|
||||||
execsh(char *cmd, char **args)
|
execsh(char *cmd, char **args)
|
||||||
{
|
{
|
||||||
char *sh, *prog;
|
char *sh, *prog, *arg;
|
||||||
const struct passwd *pw;
|
const struct passwd *pw;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -740,12 +740,16 @@ execsh(char *cmd, char **args)
|
||||||
if ((sh = getenv("SHELL")) == NULL)
|
if ((sh = getenv("SHELL")) == NULL)
|
||||||
sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
|
sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
|
||||||
|
|
||||||
if (args)
|
if (args) {
|
||||||
prog = args[0];
|
prog = args[0];
|
||||||
else if (utmp)
|
arg = NULL;
|
||||||
prog = utmp;
|
} else if (scroll || utmp) {
|
||||||
else
|
prog = scroll ? scroll : utmp;
|
||||||
|
arg = scroll ? utmp : NULL;
|
||||||
|
} else {
|
||||||
prog = sh;
|
prog = sh;
|
||||||
|
arg = NULL;
|
||||||
|
}
|
||||||
DEFAULT(args, ((char *[]) {prog, NULL}));
|
DEFAULT(args, ((char *[]) {prog, NULL}));
|
||||||
|
|
||||||
unsetenv("COLUMNS");
|
unsetenv("COLUMNS");
|
||||||
|
|
1
st.h
1
st.h
|
@ -132,6 +132,7 @@ int borderpx;
|
||||||
|
|
||||||
/* config.h globals */
|
/* config.h globals */
|
||||||
extern char *utmp;
|
extern char *utmp;
|
||||||
|
extern char *scroll;
|
||||||
extern char *stty_args;
|
extern char *stty_args;
|
||||||
extern char *vtiden;
|
extern char *vtiden;
|
||||||
extern wchar_t *worddelimiters;
|
extern wchar_t *worddelimiters;
|
||||||
|
|
Loading…
Reference in New Issue