[hackers] [st] Add an option to disable alternative screens. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Wed, 03 Apr 2013 20:44:06 +0200

commit 580c8bbd4691218849c9a809acaa4c95f65cb846
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Wed Apr 3 20:42:27 2013 +0200

    Add an option to disable alternative screens.

diff --git a/config.def.h b/config.def.h
index 693bdbd..2c97266 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -13,6 +13,9 @@ static char shell[] = "/bin/sh";
 static unsigned int doubleclicktimeout = 300;
 static unsigned int tripleclicktimeout = 600;
 
+/* alt screens */
+static bool allowaltscreen = true;
+
 /* frames per second st should at maximum draw to the screen */
 static unsigned int xfps = 60;
 static unsigned int actionfps = 30;
diff --git a/st.1 b/st.1
index 1c100c0..fc7703d 100644
--- a/st.1
+++ b/st.1
_AT_@ -3,6 +3,7 @@
 st \- simple terminal
 .SH SYNOPSIS
 .B st
+.RB [ \-a ]
 .RB [ \-c
 .IR class ]
 .RB [ \-f
_AT_@ -23,6 +24,9 @@ st \- simple terminal
 is a simple terminal emulator.
 .SH OPTIONS
 .TP
+.B \-a
+disable alternate screens in terminal
+.TP
 .BI \-c " class"
 defines the window class (default $TERM).
 .TP
diff --git a/st.c b/st.c
index 8b1fc56..18935d4 100644
--- a/st.c
+++ b/st.c
_AT_@ -43,7 +43,7 @@
 
 #define USAGE \
         "st " VERSION " (c) 2010-2013 st engineers
" \
- "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 ...]
"
 
 /* XEMBED messages */
_AT_@ -1615,7 +1615,10 @@ tsetmode(bool priv, bool set, int *args, int narg) {
                                 break;
                         case 1049: /* = 1047 and 1048 */
                         case 47:
- case 1047: {
+ case 1047:
+ if (!allowaltscreen)
+ break;
+
                                 alt = IS_SET(MODE_ALTSCREEN);
                                 if(alt) {
                                         tclearregion(0, 0, term.col-1,
_AT_@ -1625,8 +1628,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
                                         tswapscreen();
                                 if(*args != 1049)
                                         break;
- }
- /* pass through */
+ /* FALLTRU */
                         case 1048:
                                 tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
                                 break;
_AT_@ -3316,6 +3318,9 @@ main(int argc, char *argv[]) {
 
         for(i = 1; i < argc; i++) {
                 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
+ case 'a':
+ allowaltscreen = false;
+ break;
                 case 'c':
                         if(++i < argc)
                                 opt_class = argv[i];
Received on Wed Apr 03 2013 - 20:44:06 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 03 2013 - 20:48:07 CEST