Gnu-Screen

“螢幕”視窗管理器的最大回滾大小

  • July 9, 2017

螢幕”視窗管理器允許指定回滾緩衝區的所需大小。

例如,當開始一個新會話時:(source

‘-h num’
    Set the history scrollback buffer to be num lines high.
    Equivalent to the defscrollback command (see Copy).

或者當已經在使用這些命令的螢幕會話中時:(來源

12.1.2 Scrollback
— Command: defscrollback num
           Same as the scrollback command except that the default
           setting for new windows is changed. Defaults to 100. 
— Command: scrollback num
           Set the size of the scrollback buffer for the current 
           window to num lines. The default scrollback is 100 lines.
           Use C-a i to view the current setting.

但我似乎找不到說明上述num任何方法的最大值的文件。

所以問題是:如何確定螢幕實用程序的最大回滾長度?

我不確定在哪裡可以找到它的文件,但是稍微探勘一下原始碼會提供一些線索。當你傳入-h它時,它會設置histheight(參見screen.c)。其中main解析-h如下:

case 'h':
   if (--argc == 0)
       exit_with_usage(myname, NULL, NULL);
   nwin_options.histheight = atoi(*++argv);
   if (nwin_options.histheight < 0)
       exit_with_usage(myname, "-h: %s: negative scrollback size?", *argv);
   break;

該結構是在window.h中定義的nwin_options一個實例:NewWindow

struct NewWindow {
   int StartAt;    /* where to start the search for the slot */
   char    *aka;       /* aka string */
   char    **args;     /* argv vector */
   char    *dir;       /* directory for chdir */
   char    *term;      /* TERM to be set instead of "screen" */
   bool    aflag;
   bool    dynamicaka;
   int flowflag;
   int lflag;
   int histheight;
   int monitor;
   int wlock;      /* default writelock setting */
   int silence;
   bool    wrap;
   bool    Lflag;      /* logging */
   int slow;       /* inter character milliseconds */
   int gr;
   bool    c1;
   int bce;
   int encoding;
   char    *hstatus;
   char    *charset;
   int poll_zombie_timeout;
};

我們可以看到它histheight是一個 int,所以大概你可以設置它的最大值是maxint一個有符號的 int。

引用自:https://unix.stackexchange.com/questions/373115