Add an option to disable alternative screens.

This commit is contained in:
Christoph Lohmann 2013-04-03 20:42:27 +02:00
parent 502911e554
commit 580c8bbd46
3 changed files with 16 additions and 4 deletions

View file

@ -13,6 +13,9 @@ static char shell[] = "/bin/sh";
static unsigned int doubleclicktimeout = 300; static unsigned int doubleclicktimeout = 300;
static unsigned int tripleclicktimeout = 600; static unsigned int tripleclicktimeout = 600;
/* alt screens */
static bool allowaltscreen = true;
/* frames per second st should at maximum draw to the screen */ /* frames per second st should at maximum draw to the screen */
static unsigned int xfps = 60; static unsigned int xfps = 60;
static unsigned int actionfps = 30; static unsigned int actionfps = 30;

4
st.1
View file

@ -3,6 +3,7 @@
st \- simple terminal st \- simple terminal
.SH SYNOPSIS .SH SYNOPSIS
.B st .B st
.RB [ \-a ]
.RB [ \-c .RB [ \-c
.IR class ] .IR class ]
.RB [ \-f .RB [ \-f
@ -23,6 +24,9 @@ st \- simple terminal
is a simple terminal emulator. is a simple terminal emulator.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-a
disable alternate screens in terminal
.TP
.BI \-c " class" .BI \-c " class"
defines the window class (default $TERM). defines the window class (default $TERM).
.TP .TP

13
st.c
View file

@ -43,7 +43,7 @@
#define USAGE \ #define USAGE \
"st " VERSION " (c) 2010-2013 st engineers\n" \ "st " VERSION " (c) 2010-2013 st engineers\n" \
"usage: st [-v] [-c class] [-f font] [-g geometry] [-o file]" \ "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]" \
" [-t title] [-w windowid] [-e command ...]\n" " [-t title] [-w windowid] [-e command ...]\n"
/* XEMBED messages */ /* XEMBED messages */
@ -1615,7 +1615,10 @@ tsetmode(bool priv, bool set, int *args, int narg) {
break; break;
case 1049: /* = 1047 and 1048 */ case 1049: /* = 1047 and 1048 */
case 47: case 47:
case 1047: { case 1047:
if (!allowaltscreen)
break;
alt = IS_SET(MODE_ALTSCREEN); alt = IS_SET(MODE_ALTSCREEN);
if(alt) { if(alt) {
tclearregion(0, 0, term.col-1, tclearregion(0, 0, term.col-1,
@ -1625,8 +1628,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
tswapscreen(); tswapscreen();
if(*args != 1049) if(*args != 1049)
break; break;
} /* FALLTRU */
/* pass through */
case 1048: case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break; break;
@ -3316,6 +3318,9 @@ main(int argc, char *argv[]) {
for(i = 1; i < argc; i++) { for(i = 1; i < argc; i++) {
switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) { switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
case 'a':
allowaltscreen = false;
break;
case 'c': case 'c':
if(++i < argc) if(++i < argc)
opt_class = argv[i]; opt_class = argv[i];