summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2012-01-19 16:35:03 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2012-01-19 16:35:03 -0500
commitc795ac322ff7c81c8d57445337c9f70cba226d1f (patch)
tree00362a9b3c203b64de2400f0a124f9dc9e2a5397
parent869278e490913531a98602b8bec5cc08831aa46d (diff)
parent8cf5efc07048abee125a24652768f4b24fc761bf (diff)
downloadscreen-unicode++.tar.gz
Merge remote-tracking branch 'origin/master' into unicode++unicode++
-rw-r--r--src/ChangeLog2
-rw-r--r--src/Makefile.in5
-rw-r--r--src/NEWS.3.52
-rw-r--r--src/ansi.c71
-rw-r--r--src/comm.c2
-rw-r--r--src/configure.in9
-rw-r--r--src/display.c2
-rw-r--r--src/doc/screen.132
-rw-r--r--src/doc/screen.texinfo19
-rw-r--r--src/layer.c8
-rw-r--r--src/layout.c57
-rw-r--r--src/layout.h3
-rw-r--r--src/list_window.c32
-rw-r--r--src/mark.c2
-rw-r--r--src/process.c100
-rw-r--r--src/resize.c83
-rw-r--r--src/window.c2
-rw-r--r--src/window.h34
18 files changed, 312 insertions, 153 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 720a2f6..37e4eea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -106,8 +106,10 @@ Version 4.1.0 (??/??/20??):
* Christian Ebert <blacktrash@gmx.net>
* Geraint Edwards <gedge-lists-screen@yadn.org>
* Romain Francoise <romain@orebokech.com>
+ * Alexander Gattin <xrgtn@yandex.ru>
* Emanuele Giaquinta <e.giaquinta@glauco.it>
* Yi-Hsuan Hsin <mhsin@mhsin.org>
+ * Kipling Inscore <kinscore@synaptics.com>
* Chris Jones <cjns1989@gmail.com>
* Max Kalashnikov <mmt@maxkalashnikov.com>
* Steve Kemp <steve@steve.org.uk>
diff --git a/src/Makefile.in b/src/Makefile.in
index 2ae57d0..d087311 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -25,7 +25,10 @@ SCREEN = screen-$(VERSION)
GIT_REV = "`git describe --always 2>/dev/null`"
DEFS = @DEFS@ -DGIT_REV=\"$(GIT_REV)\"
-ETCSCREENRC = $(prefix)/etc/screenrc
+ETCSCREENRC = @ETCSCREENRC@
+ifeq (${ETCSCREENRC}, )
+ETCSCREENRC=$(prefix)/etc/screenrc
+endif
SCREENENCODINGS = $(datadir)/screen/utf8encodings
CC = @CC@
diff --git a/src/NEWS.3.5 b/src/NEWS.3.5
index d0d1970..74bb7bf 100644
--- a/src/NEWS.3.5
+++ b/src/NEWS.3.5
@@ -77,7 +77,7 @@
document.
* Screen can now be started detached (screen -d -m -S sockname).
- This is usefull if you want to start screen in your /etc/rc file
+ This is useful if you want to start screen in your /etc/rc file
(e.g. as a console multiplexer)
* Console grabbing added ('console on' command).
diff --git a/src/ansi.c b/src/ansi.c
index 2486e77..5291f84 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -125,8 +125,8 @@ static void DesignateCharset __P((int, int));
static void MapCharset __P((int));
static void MapCharsetR __P((int));
#endif
-static void SaveCursor __P((void));
-static void RestoreCursor __P((void));
+static void SaveCursor __P((struct cursor *));
+static void RestoreCursor __P((struct cursor *));
static void BackSpace __P((void));
static void Return __P((void));
static void LineFeed __P((int));
@@ -203,7 +203,7 @@ register struct win *p;
p->w_cursorkeys = 0;
p->w_top = 0;
p->w_bot = p->w_height - 1;
- p->w_saved = 0;
+ p->w_saved.on = 0;
p->w_x = p->w_y = 0;
p->w_state = LIT;
p->w_StringType = NONE;
@@ -990,10 +990,10 @@ int c, intermediate;
Report("\033[?%d;%dc", 1, 2);
break;
case '7':
- SaveCursor();
+ SaveCursor(&curr->w_saved);
break;
case '8':
- RestoreCursor();
+ RestoreCursor(&curr->w_saved);
break;
case 'c':
ClearScreen();
@@ -1236,7 +1236,7 @@ int c, intermediate;
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
break;
case 's':
- SaveCursor();
+ SaveCursor(&curr->w_saved);
break;
case 't':
switch(a1)
@@ -1277,7 +1277,7 @@ int c, intermediate;
}
break;
case 'u':
- RestoreCursor();
+ RestoreCursor(&curr->w_saved);
break;
case 'I':
if (!a1)
@@ -1434,15 +1434,28 @@ int c, intermediate;
if (use_altscreen)
{
if (i)
- EnterAltScreen(curr);
+ {
+ if (!curr->w_alt.on)
+ SaveCursor(&curr->w_alt.cursor);
+ EnterAltScreen(curr);
+ }
else
- LeaveAltScreen(curr);
+ {
+ LeaveAltScreen(curr);
+ RestoreCursor(&curr->w_alt.cursor);
+ }
if (a1 == 47 && !i)
- curr->w_saved = 0;
+ curr->w_saved.on = 0;
LRefreshAll(&curr->w_layer, 0);
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
break;
+ case 1048:
+ if (i)
+ SaveCursor(&curr->w_saved);
+ else
+ RestoreCursor(&curr->w_saved);
+ break;
/* case 66: NKM: Numeric keypad appl mode */
/* case 68: KBUM: Keyboard usage mode (data process) */
case 1000: /* VT200 mouse tracking */
@@ -1758,34 +1771,36 @@ int n;
#endif /* FONT */
static void
-SaveCursor()
+SaveCursor(cursor)
+struct cursor *cursor;
{
- curr->w_saved = 1;
- curr->w_Saved_x = curr->w_x;
- curr->w_Saved_y = curr->w_y;
- curr->w_SavedRend = curr->w_rend;
+ cursor->on = 1;
+ cursor->x = curr->w_x;
+ cursor->y = curr->w_y;
+ cursor->Rend = curr->w_rend;
#ifdef FONT
- curr->w_SavedCharset = curr->w_Charset;
- curr->w_SavedCharsetR = curr->w_CharsetR;
- bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets,
+ cursor->Charset = curr->w_Charset;
+ cursor->CharsetR = curr->w_CharsetR;
+ bcopy((char *) curr->w_charsets, (char *) cursor->Charsets,
4 * sizeof(int));
#endif
}
static void
-RestoreCursor()
+RestoreCursor(cursor)
+struct cursor *cursor;
{
- if (!curr->w_saved)
+ if (!cursor->on)
return;
- LGotoPos(&curr->w_layer, curr->w_Saved_x, curr->w_Saved_y);
- curr->w_x = curr->w_Saved_x;
- curr->w_y = curr->w_Saved_y;
- curr->w_rend = curr->w_SavedRend;
+ LGotoPos(&curr->w_layer, cursor->x, cursor->y);
+ curr->w_x = cursor->x;
+ curr->w_y = cursor->y;
+ curr->w_rend = cursor->Rend;
#ifdef FONT
- bcopy((char *) curr->w_SavedCharsets, (char *) curr->w_charsets,
+ bcopy((char *) cursor->Charsets, (char *) curr->w_charsets,
4 * sizeof(int));
- curr->w_Charset = curr->w_SavedCharset;
- curr->w_CharsetR = curr->w_SavedCharsetR;
+ curr->w_Charset = cursor->Charset;
+ curr->w_CharsetR = cursor->CharsetR;
curr->w_ss = 0;
curr->w_FontL = curr->w_charsets[curr->w_Charset];
curr->w_FontR = curr->w_charsets[curr->w_CharsetR];
@@ -2916,6 +2931,8 @@ struct win *p;
int visual;
{
struct canvas *cv;
+ if (displays == NULL)
+ p->w_bell = BELL_DONE;
for (display = displays; display; display = display->d_next)
{
for (cv = D_cvlist; cv; cv = cv->c_next)
diff --git a/src/comm.c b/src/comm.c
index aa512de..5f4af8a 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -195,7 +195,7 @@ struct comm comms[RC_LAST + 1] =
{ "focusminsize", ARGS_02 },
{ "gr", NEED_FORE|ARGS_01 },
{ "group", NEED_FORE|ARGS_01 },
- { "hardcopy", ARGS_012 },
+ { "hardcopy", NEED_FORE|ARGS_012 },
{ "hardcopy_append", ARGS_1 },
{ "hardcopydir", ARGS_01 },
{ "hardstatus", ARGS_012 },
diff --git a/src/configure.in b/src/configure.in
index bd29de2..4184947 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1217,14 +1217,14 @@ AC_HEADER_DIRENT
AC_MSG_CHECKING(for setenv)
if test -z "$ac_setenv_args"; then
- AC_TRY_COMPILE(
+ AC_TRY_LINK(
[#include <stdlib.h>],
[
setenv((char *) 0, (char *) 0, 0);
], ac_setenv_args=3)
fi
if test -z "$ac_setenv_args"; then
- AC_TRY_COMPILE(
+ AC_TRY_LINK(
[#include <stdlib.h>],
[
setenv((char *) 0, (char *) 0);
@@ -1294,6 +1294,11 @@ test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
+ETCSCREENRC=
+AC_MSG_CHECKING(for the global screenrc file)
+AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ])
+AC_SUBST(ETCSCREENRC)
+
AC_OUTPUT(Makefile doc/Makefile, [[
# a hook for preserving undef directive in config.h
mv config.h conftest
diff --git a/src/display.c b/src/display.c
index dd6500e..a967e66 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2524,7 +2524,7 @@ int from, to, y, bce;
DisplayLine(oml, &mline_blank, y, from, to);
return;
}
- bcechar = mchar_blank;
+ bcechar = mchar_null;
rend_setbg(&bcechar, bce);
for (x = from; x <= to; x++)
copy_mchar2mline(&bcechar, &mline_old, x);
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index ff2fe82..c175891 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -2183,7 +2183,7 @@ If no arguments are given, the current settings are displayed.
.BR "ignorecase " [ on | off ]
.PP
Tell screen to ignore the case of characters in searches. Default is
-`off'.
+`off'. Without any options, the state of ignorecase is toggled.
.sp
.ne 3
.B info
@@ -2479,11 +2479,11 @@ Like mapdefault, but don't even look in the default bindkey table.
.sp
.ne 3
.B maptimeout
-.RI [ timo ]
+.RI [ timeout ]
.PP
Set the inter-character timer for input sequence detection to a timeout
of
-.I timo
+.I timeout
ms. The default timeout is 300ms. Maptimeout with no arguments shows
the current setting.
See also \*Qbindkey\*U.
@@ -2905,8 +2905,9 @@ See also chapter \*QWINDOW TYPES\*U.
.PP
Set the size of the scrollback buffer for the current windows to \fInum\fP
lines. The default scrollback is 100 lines.
-See also the \*Qdefscrollback\*U command and use \*QC-a i\*U to view the
-current setting.
+See also the \*Qdefscrollback\*U command and use \*Qinfo\*U to view the
+current setting. To access and use the contents in the scrollback buffer,
+use the \*Qcopy\*U command.
.sp
.ne 3
.BR "select " [ \fIWindowID ]
@@ -3206,7 +3207,7 @@ man page for more information on termcap definitions.
.PP
Uses the message line to display the time of day, the host name, and the load
averages over 1, 5, and 15 minutes (if this is available on your system).
-For window specific information use \*Qinfo\*U.
+For window specific information, use \*Qinfo\*U.
If a string is specified, it changes the format of the time report like it is
described in the \*QSTRING ESCAPES\*U chapter. Screen uses a default of
@@ -3269,7 +3270,7 @@ Sets the visual bell message. \fImessage\fP is printed to the status line if
the window receives a bell character (^G), vbell is set to \*Qon\*U, but the
terminal does not support a visual bell.
The default message is \*QWuff, Wuff!!\*U.
-Without parameter, the current message is shown.
+Without a parameter, the current message is shown.
.sp
.ne 3
.BI "vbellwait " sec
@@ -3284,7 +3285,7 @@ visual bell message. The default is 1 second.
.PP
If verbose is switched on, the command name is echoed, whenever a window
is created (or resurrected from zombie state). Default is off.
-Without parameter, the current setting is shown.
+Without a parameter, the current setting is shown.
.sp
.ne 3
.B version
@@ -3369,6 +3370,9 @@ The following keys are used to navigate in \*Qwindowlist\*U:
\fBC-b\fP or \fBC-f\fP Move one full page up or down.
.br
.ti -2n
+\fB0..9\fP Using the number keys, move to the selected line.
+.br
+.ti -2n
\fBmouseclick\fP Move to the selected line. Available when
\*Qmousetrack\*U is set to \*Qon\*U
.br
@@ -3444,7 +3448,7 @@ When line-wrap is on, the second consecutive printable character output at
the last column of a line will wrap to the start of the following line.
As an added feature, backspace (^H) will also wrap through the left margin
to the previous line.
-Default is `on'.
+Default is `on'. Without any options, the state of wrap is toggled.
.sp
.ne 3
.B writebuf
@@ -3610,13 +3614,12 @@ Signals that are logical low (inactive) have their name preceded by
an exclamation mark (!), otherwise the signal is logical high (active).
Signals not supported by the hardware but available to the ioctl() interface
are usually shown low.
-.br
+.PP
When the CLOCAL status bit is true, the whole set of modem signals is placed
inside curly braces ({ and }).
When the CRTSCTS or TIOCSOFTCAR bit is set, the signals `CTS' or `CD'
are shown in parenthesis, respectively.
-
-
+.PP
For tty windows, the command
.B break
causes the Data transmission line (TxD) to go low for a specified period of
@@ -3625,6 +3628,7 @@ No data is sent and no modem control line is changed when a
.B break
is issued.
.RE
+
.IP \(bu
If the first parameter is \*Q//telnet\*U, the second parameter is expected to
be a host name, and an optional third parameter may specify a TCP port number
@@ -3689,7 +3693,7 @@ day number
.IP D
weekday name
.IP f
-flags of the window
+flags of the window, see \*Qwindows\*U for meanings of the various flags
.IP F
sets %? to true if the window has the focus
.IP h
@@ -4943,7 +4947,7 @@ Pablo Averbuj (pablo@averbuj.com).
.SH VERSION
-This is version 4.0.2. Its roots are a merge of a custom version
+This is version 4.1.0. Its roots are a merge of a custom version
2.3PR7 by Wayne Davison
and several enhancements to Oliver Laumann's version 2.0. Note that all versions
numbered 2.x are copyright by Oliver Laumann.
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index 539f23d..08ca259 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -1026,7 +1026,7 @@ Find previous command beginning @dots{}. @xref{History}.
Change the window's hardstatus line. @xref{Hardstatus}.
@item idle [@var{timeout} [@var{cmd} @var{args}]]
Define a screen saver command. @xref{Screen Saver}.
-@item ignorecase [@var{state}]
+@item ignorecase [on|off]
Ignore character case in searches. @xref{Searching}.
@item info
Display window settings. @xref{Info}.
@@ -1222,7 +1222,7 @@ Set the width of the window. @xref{Window Size}.
Present a list of all windows for selection. @xref{Windowlist}.
@item windows
List active windows. @xref{Windows}.
-@item wrap [@var{state}]
+@item wrap [ on | off ]
Control line-wrap behavior. @xref{Wrap}.
@item writebuf [-e @var{encoding}] [@var{filename}]
Write paste buffer to screen-exchange file. @xref{Screen Exchange}.
@@ -1610,6 +1610,9 @@ The following keys are used to navigate in @code{windowlist}:
@noindent
@kbd{C-b} or @kbd{C-f} Move one full page up or down.
+@indent
+@kbd{0..9} Using the number keys, move to the selected line.
+
@noindent
@kbd{mouseclick} Move to the selected line. Available when
@code{mousetrack} is set to @code{on}.
@@ -3275,13 +3278,14 @@ partial redraw mode.
@kindex r
@kindex C-r
-@deffn Command wrap state
+@deffn Command wrap [ on | off ]
(@kbd{C-a r}, @kbd{C-a C-r}) @*
Sets the line-wrap setting for the current window. When line-wrap is
on, the second consecutive printable character output at the last column
of a line will wrap to the start of the following line. As an added
feature, backspace (^H) will also wrap through the left margin to the
-previous line. Default is @samp{on}.
+previous line. Default is @samp{on}. Without any options, the state of
+@code{wrap} is toggled.
@end deffn
@deffn Command defwrap state
@@ -3519,7 +3523,7 @@ to hold more useful lines in your scrollback buffer.
@end deffn
@node Copy Mode Keys, Movement, Scrollback, Copy
-@subsection markkeys
+@subsection Markkeys
@deffn Command markkeys string
(none)@*
This is a method of changing the keymap used for copy/history mode. The
@@ -3651,10 +3655,11 @@ will copy lines 11 to 15 into the paste buffer.
@noindent
@kbd{C-r} @code{emacs} style reverse i-search.
-@deffn Command ignorecase [state]
+@deffn Command ignorecase [on|off]
(none)@*
Tell screen to ignore the case of characters in searches. Default is
-@code{off}.
+@code{off}. Without any options, the state of @code{ignorecase}
+is toggled.
@end deffn
@noindent
diff --git a/src/layer.c b/src/layer.c
index fd00063..d581671 100644
--- a/src/layer.c
+++ b/src/layer.c
@@ -335,7 +335,13 @@ int x, y;
#endif
if (l->l_pause.d)
- LayPauseUpdateRegion(l, x, x, y, y);
+ LayPauseUpdateRegion(l, x,
+#ifdef DW_CHARS
+ x + (c->mbcs ? 1 : 0)
+#else
+ x
+#endif
+ , y, y);
FOR_EACH_UNPAUSED_CANVAS(l,
{
diff --git a/src/layout.c b/src/layout.c
index 6100b5d..584abbd 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -64,7 +64,7 @@ CreateLayout(title, startat)
char *title;
int startat;
{
- struct layout *lay;
+ struct layout *lay, **pl;
int i;
if (startat >= MAXLAY || startat < 0)
@@ -86,8 +86,12 @@ int startat;
lay->lay_autosave = 1;
lay->lay_number = i;
laytab[i] = lay;
- lay->lay_next = layouts;
- layouts = lay;
+ lay->lay_next = 0;
+
+ pl = &layouts;
+ while (*pl)
+ pl = &(*pl)->lay_next;
+ *pl = lay;
return lay;
}
@@ -164,6 +168,8 @@ struct canvas *cv;
FreeCanvas(D_canvas.c_slperp);
D_cvlist = 0;
D_forecv = lay->lay_forecv;
+ if (!D_forecv)
+ MakeDefaultCanvas();
DupLayoutCv(&lay->lay_canvas, &D_canvas, 0);
D_canvas.c_ye = D_height - 1 - ((D_canvas.c_slperp && D_canvas.c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE);
ResizeCanvas(&D_canvas);
@@ -185,12 +191,20 @@ int startat;
lay = CreateLayout(title, startat);
if (!lay)
return;
- LoadLayout(0, &D_canvas);
- fcv = D_forecv;
- DupLayoutCv(&D_canvas, &lay->lay_canvas, 1);
- lay->lay_forecv = D_forecv;
- D_forecv = fcv;
- D_layout = lay;
+
+ if (display)
+ {
+ LoadLayout(0, &D_canvas);
+ fcv = D_forecv;
+ DupLayoutCv(&D_canvas, &lay->lay_canvas, 1);
+ lay->lay_forecv = D_forecv;
+ D_forecv = fcv;
+ D_layout = lay;
+ }
+ else
+ {
+ layout_attach = lay;
+ }
lay->lay_autosave = 1;
}
@@ -365,3 +379,28 @@ char *filename;
return 1;
}
+void RenameLayout(layout, name)
+struct layout *layout;
+const char *name;
+{
+ free(layout->lay_title);
+ layout->lay_title = SaveStr(name);
+}
+
+int RenumberLayout(layout, number)
+struct layout *layout;
+int number;
+{
+ int old;
+ struct layout *lay;
+ old = layout->lay_number;
+ if (number < 0 || number >= MAXLAY)
+ return 0;
+ lay = laytab[number];
+ laytab[number] = layout;
+ layout->lay_number = number;
+ laytab[old] = lay;
+ if (lay)
+ lay->lay_number = old;
+ return 1;
+}
diff --git a/src/layout.h b/src/layout.h
index 065edb7..1814226 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -53,5 +53,8 @@ extern void ShowLayouts __P((int));
extern struct layout *FindLayout __P((char *));
extern void UpdateLayoutCanvas __P((struct canvas *, struct win *));
+extern void RenameLayout __P((struct layout *, const char *));
+extern int RenumberLayout __P((struct layout *, int));
+
#endif /* SCREEN_LAYOUT_H */
diff --git a/src/list_window.c b/src/list_window.c
index b65600d..4fd65d0 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -427,6 +427,38 @@ gl_Window_input(struct ListData *ldata, char **inp, int *len)
}
break;
default:
+ if (ch >= '0' && ch <= '9')
+ {
+ struct ListRow *row = ldata->root;
+ for (; row; row = row->next)
+ {
+ struct win *w = row->data;
+ if (w->w_number == ch - '0')
+ {
+ struct ListRow *old = ldata->selected;
+ if (old == row)
+ break;
+ ldata->selected = row;
+ if (ldata->selected->y == -1)
+ {
+ /* We need to list all the rows, since we are scrolling down. But first,
+ * find the top of the visible list. */
+ ldata->top = row;
+ glist_display_all(ldata);
+ }
+ else
+ {
+ /* just redisplay the two lines. */
+ ldata->list_fn->gl_printrow(ldata, old);
+ ldata->list_fn->gl_printrow(ldata, ldata->selected);
+ flayer->l_y = ldata->selected->y;
+ LaySetCursor();
+ }
+ break;
+ }
+ }
+ break;
+ }
--*inp;
++*len;
return 0;
diff --git a/src/mark.c b/src/mark.c
index c4edd65..c2c7306 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -771,7 +771,7 @@ processchar:
LGotoPos(flayer, cx, W2D(cy));
break;
case '@':
- /* it may be usefull to have a key that does nothing */
+ /* it may be useful to have a key that does nothing */
break;
case '%':
rep_cnt--;
diff --git a/src/process.c b/src/process.c
index cc2b56f..dfa7c82 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1154,6 +1154,7 @@ int key;
char ch;
struct display *odisplay = display;
struct acluser *user;
+ struct layout *layout;
user = display ? D_user : users;
if (nr == RC_ILLEGAL)
@@ -1271,22 +1272,27 @@ int key;
case RC_HARDCOPY:
{
int mode = DUMP_HARDCOPY;
+ char *file = NULL;
- if (argc > 1 && !strcmp(*args, "-h"))
+ if (args[0])
{
- mode = DUMP_SCROLLBACK;
- args++;
- argc--;
+ if (!strcmp(*args, "-h"))
+ {
+ mode = DUMP_SCROLLBACK;
+ file = args[1];
+ }
+ else if (!strcmp(*args, "--") && args[1])
+ file = args[1];
+ else
+ file = args[0];
}
- if (*args && args[1])
+
+ if (args[0] && file == args[0] && args[1])
{
OutputMsg(0, "%s: hardcopy: too many arguments", rc_name);
break;
}
- if (fore == 0 && *args == 0)
- OutputMsg(0, "%s: hardcopy: window required", rc_name);
- else
- WriteFile(user, *args, mode);
+ WriteFile(user, file, mode);
}
break;
case RC_DEFLOG:
@@ -4241,8 +4247,22 @@ int key;
}
break;
case RC_LAYOUT:
+ // A number of the subcommands for "layout" are ignored, or not processed correctly when there
+ // is no attached display.
+
if (!strcmp(args[0], "title"))
{
+ if (!display)
+ {
+ if (!args[1]) // There is no display, and there is no new title. Ignore.
+ break;
+ if (!layout_attach || layout_attach == &layout_last_marker)
+ layout_attach = CreateLayout(args[1], 0);
+ else
+ RenameLayout(layout_attach, args[1]);
+ break;
+ }
+
if (!D_layout)
{
OutputMsg(0, "not on a layout");
@@ -4253,13 +4273,17 @@ int key;
OutputMsg(0, "current layout is %d (%s)", D_layout->lay_number, D_layout->lay_title);
break;
}
- free(D_layout->lay_title);
- D_layout->lay_title= SaveStr(args[1]);
+ RenameLayout(D_layout, args[1]);
}
else if (!strcmp(args[0], "number"))
{
- int old;
- struct layout *lay;
+ if (!display)
+ {
+ if (args[1] && layout_attach && layout_attach != &layout_last_marker)
+ RenumberLayout(layout_attach, atoi(args[1]));
+ break;
+ }
+
if (!D_layout)
{
OutputMsg(0, "not on a layout");
@@ -4270,20 +4294,23 @@ int key;
OutputMsg(0, "This is layout %d (%s).\n", D_layout->lay_number, D_layout->lay_title);
break;
}
- old = D_layout->lay_number;
- n = atoi(args[1]);
- if (n < 0 || n >= MAXLAY)
- break;
- lay = laytab[n];
- laytab[n] = D_layout;
- D_layout->lay_number = n;
- laytab[old] = lay;
- if (lay)
- lay->lay_number = old;
+ RenumberLayout(D_layout, atoi(args[1]));
break;
}
else if (!strcmp(args[0], "autosave"))
{
+ if (!display)
+ {
+ if (args[1] && layout_attach && layout_attach != &layout_last_marker)
+ {
+ if (!strcmp(args[1], "on"))
+ layout_attach->lay_autosave = 1;
+ else if (!strcmp(args[1], "off"))
+ layout_attach->lay_autosave = 0;
+ }
+ break;
+ }
+
if (!D_layout)
{
OutputMsg(0, "not on a layout");
@@ -4333,10 +4360,17 @@ int key;
OutputMsg(0, "usage: layout save <name>");
break;
}
- SaveLayout(args[1], &D_canvas);
+ if (display)
+ SaveLayout(args[1], &D_canvas);
}
else if (!strcmp(args[0], "select"))
{
+ if (!display)
+ {
+ if (args[1])
+ layout_attach = FindLayout(args[1]);
+ break;
+ }
if (!args[1])
{
Input("Switch to layout: ", 20, INP_COOKED, SelectLayoutFin, NULL, 0);
@@ -4346,6 +4380,12 @@ int key;
}
else if (!strcmp(args[0], "next"))
{
+ if (!display)
+ {
+ if (layout_attach && layout_attach != &layout_last_marker)
+ layout_attach = layout_attach->lay_next ? layout_attach->lay_next : layouts;;
+ break;
+ }
struct layout *lay = D_layout;
if (lay)
lay = lay->lay_next ? lay->lay_next : layouts;
@@ -4363,14 +4403,22 @@ int key;
}
else if (!strcmp(args[0], "prev"))
{
- struct layout *lay = D_layout;
+ struct layout *lay = display ? D_layout : layout_attach;
+ struct layout *target = lay;
if (lay)
{
- for (lay = layouts; lay->lay_next && lay->lay_next != D_layout; lay = lay->lay_next)
+ for (lay = layouts; lay->lay_next && lay->lay_next != target; lay = lay->lay_next)
;
}
else
lay = layouts;
+
+ if (!display)
+ {
+ layout_attach = lay;
+ break;
+ }
+
if (!lay)
{
OutputMsg(0, "no layout defined");
diff --git a/src/resize.c b/src/resize.c
index d025730..1bbd169 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -586,10 +586,10 @@ int wi;
#ifdef COPY_PASTE
RESET_LINES(p->w_hlines, p->w_histheight);
- RESET_LINES(p->w_alt_hlines, p->w_alt_histheight);
+ RESET_LINES(p->w_alt.hlines, p->w_alt.histheight);
#endif
- RESET_LINES(p->w_alt_mlines, p->w_alt_height);
+ RESET_LINES(p->w_alt.mlines, p->w_alt.height);
}
}
@@ -665,14 +665,6 @@ int wi, he, hi;
he = 1000;
}
-#ifdef COPY_PASTE
- if (hi > 1000)
- {
- Msg(0, "Window history too big. Truncated to 1000.");
- hi = 1000;
- }
-#endif
-
if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
{
debug("ChangeWindowSize: No change.\n");
@@ -958,8 +950,8 @@ int wi, he, hi;
}
}
- /* Change w_Saved_y - this is only an estimate... */
- p->w_Saved_y += ncy - p->w_y;
+ /* Change w_saved.y - this is only an estimate... */
+ p->w_saved.y += ncy - p->w_y;
p->w_x = ncx;
p->w_y = ncy;
@@ -971,12 +963,16 @@ int wi, he, hi;
p->w_x = wi;
if (p->w_y >= he)
p->w_y = he - 1;
- if (p->w_Saved_x > wi)
- p->w_Saved_x = wi;
- if (p->w_Saved_y < 0)
- p->w_Saved_y = 0;
- if (p->w_Saved_y >= he)
- p->w_Saved_y = he - 1;
+ if (p->w_saved.x > wi)
+ p->w_saved.x = wi;
+ if (p->w_saved.y < 0)
+ p->w_saved.y = 0;
+ if (p->w_saved.y >= he)
+ p->w_saved.y = he - 1;
+ if (p->w_alt.cursor.x > wi)
+ p->w_alt.cursor.x = wi;
+ if (p->w_alt.cursor.y >= he)
+ p->w_alt.cursor.y = he - 1;
/* reset scrolling region */
p->w_top = 0;
@@ -1035,28 +1031,26 @@ struct win *p;
{
int i;
- if (p->w_alt_mlines)
+ if (p->w_alt.mlines)
{
- for (i = 0; i < p->w_alt_height; i++)
- FreeMline(p->w_alt_mlines + i);
- free(p->w_alt_mlines);
+ for (i = 0; i < p->w_alt.height; i++)
+ FreeMline(p->w_alt.mlines + i);
+ free(p->w_alt.mlines);
}
- p->w_alt_mlines = 0;
- p->w_alt_width = 0;
- p->w_alt_height = 0;
- p->w_alt_x = 0;
- p->w_alt_y = 0;
+ p->w_alt.mlines = 0;
+ p->w_alt.width = 0;
+ p->w_alt.height = 0;
#ifdef COPY_PASTE
- if (p->w_alt_hlines)
+ if (p->w_alt.hlines)
{
- for (i = 0; i < p->w_alt_histheight; i++)
- FreeMline(p->w_alt_hlines + i);
- free(p->w_alt_hlines);
+ for (i = 0; i < p->w_alt.histheight; i++)
+ FreeMline(p->w_alt.hlines + i);
+ free(p->w_alt.hlines);
}
- p->w_alt_hlines = 0;
- p->w_alt_histidx = 0;
+ p->w_alt.hlines = 0;
+ p->w_alt.histidx = 0;
+ p->w_alt.histheight = 0;
#endif
- p->w_alt_histheight = 0;
}
static void
@@ -1066,16 +1060,14 @@ struct win *p;
struct mline *ml;
int t;
-#define SWAP(item, t) do { (t) = p->w_alt_##item; p->w_alt_##item = p->w_##item; p->w_##item = (t); } while (0)
+#define SWAP(item, t) do { (t) = p->w_alt. item; p->w_alt. item = p->w_##item; p->w_##item = (t); } while (0)
SWAP(mlines, ml);
SWAP(width, t);
SWAP(height, t);
- SWAP(histheight, t);
- SWAP(x, t);
- SWAP(y, t);
#ifdef COPY_PASTE
+ SWAP(histheight, t);
SWAP(hlines, ml);
SWAP(histidx, t);
#endif
@@ -1086,8 +1078,7 @@ void
EnterAltScreen(p)
struct win *p;
{
- int ox = p->w_x, oy = p->w_y;
- if (!p->w_alt_current)
+ if (!p->w_alt.on)
{
/* If not already using the alternate screen buffer, then create
a new one and swap it with the 'real' screen buffer. */
@@ -1101,20 +1092,18 @@ struct win *p;
p->w_height = 0;
p->w_histheight = 0;
}
- ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight);
- p->w_x = ox;
- p->w_y = oy;
- p->w_alt_current = 1;
+ ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight);
+ p->w_alt.on = 1;
}
void
LeaveAltScreen(p)
struct win *p;
{
- if (!p->w_alt_current)
+ if (!p->w_alt.on)
return;
SwapAltScreen(p);
- ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight);
+ ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight);
FreeAltScreen(p);
- p->w_alt_current = 0;
+ p->w_alt.on = 0;
}
diff --git a/src/window.c b/src/window.c
index 6916eca..9a0df28 100644
--- a/src/window.c
+++ b/src/window.c
@@ -643,7 +643,7 @@ struct NewWindow *newwin;
#ifdef MULTIUSER
/*
* This is dangerous: without a display we use creators umask
- * This is intended to be usefull for detached startup.
+ * This is intended to be useful for detached startup.
* But is still better than default bits with a NULL user.
*/
if (NewWindowAcl(p, display ? D_user : users))
diff --git a/src/window.h b/src/window.h
index 47f5c9e..7311ecb 100644
--- a/src/window.h
+++ b/src/window.h
@@ -188,14 +188,16 @@ struct win
int w_charsets[4]; /* Font = charsets[Charset] */
#endif
int w_ss;
- int w_saved;
- int w_Saved_x, w_Saved_y;
- struct mchar w_SavedRend;
+ struct cursor {
+ int on;
+ int x, y;
+ struct mchar Rend;
#ifdef FONT
- int w_SavedCharset;
- int w_SavedCharsetR;
- int w_SavedCharsets[4];
+ int Charset;
+ int CharsetR;
+ int Charsets[4];
#endif
+ } w_saved;
int w_top, w_bot; /* scrollregion */
int w_wrap; /* autowrap */
int w_origin; /* origin mode */
@@ -276,16 +278,20 @@ struct win
int w_telsubidx;
struct event w_telconnev;
#endif
- struct mline *w_alt_mlines;
- int w_alt_width;
- int w_alt_height;
- int w_alt_histheight;
- int w_alt_x, w_alt_y;
+ struct {
+ int on; /* Is the alternate buffer currently being used? */
+ struct mline *mlines;
+ int width;
+ int height;
#ifdef COPY_PASTE
- struct mline *w_alt_hlines;
- int w_alt_histidx;
+ int histheight;
+ struct mline *hlines;
+ int histidx;
+#else
+ int histheight; /* 0 */
#endif
- int w_alt_current; /* Is the alternate buffer currently being used? */
+ struct cursor cursor;
+ } w_alt;
struct event w_destroyev; /* window destroy event */
#ifdef BSDWAIT