summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/05prefer-libtinfo-over-libcurses.patch35
-rw-r--r--debian/patches/11replace_doc_paths.patch198
-rw-r--r--debian/patches/13split_info_files.patch17
-rw-r--r--debian/patches/26source_encoding.patch357
-rw-r--r--debian/patches/45suppress_remap.patch15
-rw-r--r--debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch57
-rw-r--r--debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch38
-rw-r--r--debian/patches/63-add-utempter-switch.patch24
-rw-r--r--debian/patches/65-wcwidth.patch147
-rw-r--r--debian/patches/80_session_creation_docs.patch74
-rw-r--r--debian/patches/81_session_creation_util.patch77
-rw-r--r--debian/patches/82_session_creation_core.patch161
-rw-r--r--debian/patches/85_bracketed-paste-patch-by-Unit193_dpaste.com_5KJ572GZM.patch281
-rw-r--r--debian/patches/90_fix_man_page_bash_example.patch32
-rw-r--r--debian/patches/series17
15 files changed, 1530 insertions, 0 deletions
diff --git a/debian/patches/05prefer-libtinfo-over-libcurses.patch b/debian/patches/05prefer-libtinfo-over-libcurses.patch
new file mode 100644
index 0000000..db1d6ea
--- /dev/null
+++ b/debian/patches/05prefer-libtinfo-over-libcurses.patch
@@ -0,0 +1,35 @@
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?filename=0001-Prefer-libtinfo-over-libcurses.patch;att=1;msg=14;bug=819789
+From: Sven Joachim <svenjoac@gmx.de>
+Date: Sat, 2 Apr 2016 13:31:00 +0200
+Subject: Prefer libtinfo over libcurses
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819789
+Forwarded: no
+
+Try to link with -ltinfo before -lcurses to avoid a spurious
+dependency on systems where ncurses is built with "--with-termlib".
+---
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -626,6 +626,9 @@
+ AC_CHECKING(for tgetent)
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ olibs="$LIBS"
++LIBS="-ltinfo $olibs"
++AC_CHECKING(libtinfo)
++AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ LIBS="-lcurses $olibs"
+ AC_CHECKING(libcurses)
+ AC_TRY_LINK(,[
+@@ -650,9 +653,6 @@
+ LIBS="-lncurses $olibs"
+ AC_CHECKING(libncurses)
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+-LIBS="-ltinfo $olibs"
+-AC_CHECKING(libtinfo)
+-AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ AC_MSG_ERROR(!!! no tgetent - no screen)))))))))
+
+ AC_TRY_RUN([
diff --git a/debian/patches/11replace_doc_paths.patch b/debian/patches/11replace_doc_paths.patch
new file mode 100644
index 0000000..be95e5d
--- /dev/null
+++ b/debian/patches/11replace_doc_paths.patch
@@ -0,0 +1,198 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Fix the references to configuration and pipe paths to match the locations Debian uses.
+Forwarded: not-needed
+
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -100,7 +100,7 @@
+ the invoking shell to the application (emacs in this case), because it is
+ forked from the parent screen process, not from the invoking shell.
+ .PP
+-If \*Q/etc/utmp\*U is writable by
++If \*Q/run/utmp\*U is writable by
+ .IR screen ,
+ an appropriate record will be written to this file for each window, and
+ removed when the window is terminated.
+@@ -229,7 +229,7 @@
+ The use of this option is discouraged.
+ .TP 5
+ .BR \-l " and " \-ln
+-turns login mode on or off (for /etc/utmp updating).
++turns login mode on or off (for /run/utmp updating).
+ This can also be defined through the \*Qdeflogin\*U .screenrc command.
+ .TP 5
+ .BR \-ls " [" \fImatch ]
+@@ -767,7 +767,7 @@
+
+ .SH CUSTOMIZATION
+ The \*Qsocket directory\*U defaults either to $HOME/.screen or simply to
+-/tmp/screens or preferably to /usr/local/screens chosen at compile-time. If
++/tmp/screens or preferably to /run/screen chosen at compile-time. If
+ .I screen
+ is installed setuid-root, then the administrator
+ should compile
+@@ -780,7 +780,7 @@
+ When
+ .I screen
+ is invoked, it executes initialization commands from the files
+-\*Q/usr/local/etc/screenrc\*U and
++\*Q/etc/screenrc\*U and
+ \*Q.screenrc\*U in the user's home directory. These are the \*Qprogrammer's
+ defaults\*U that can be overridden in the following ways: for the
+ global screenrc file
+@@ -2050,7 +2050,7 @@
+ The echo command may be used to annoy
+ .I screen
+ users with a 'message of the
+-day'. Typically installed in a global /local/etc/screenrc.
++day'. Typically installed in a global /etc/screenrc.
+ The option \*Q\-n\*U may be used to suppress the line feed.
+ See also \*Qsleep\*U.
+ Echo is also useful for online checking of environment variables.
+@@ -5205,14 +5205,14 @@
+ .I screen
+ distribution package for private and global initialization files.
+ .IP $SYSSCREENRC
+-.IP /usr/local/etc/screenrc
++.IP /etc/screenrc
+ .I screen
+ initialization commands
+ .IP $SCREENRC
+ .IP $HOME/.screenrc
+-Read in after /usr/local/etc/screenrc
++Read in after /etc/screenrc
+ .IP $SCREENDIR/S\-<login>
+-.IP /local/screens/S\-<login>
++.IP /run/screen/S\-<login>
+ Socket directories (default)
+ .IP /usr/tmp/screens/S\-<login>
+ Alternate socket directories.
+@@ -5231,7 +5231,7 @@
+ or
+ .IP /etc/termcap
+ Terminal capability databases
+-.IP /etc/utmp
++.IP /run/utmp
+ Login records
+ .IP $LOCKPRG
+ Program that locks a terminal.
+@@ -5356,9 +5356,9 @@
+ must be installed as set-uid with owner root on most systems in order
+ to be able to correctly change the owner of the tty device file for
+ each window.
+-Special permission may also be required to write the file \*Q/etc/utmp\*U.
++Special permission may also be required to write the file \*Q/run/utmp\*U.
+ .IP \(bu
+-Entries in \*Q/etc/utmp\*U are not removed when
++Entries in \*Q/run/utmp\*U are not removed when
+ .I screen
+ is killed with SIGKILL.
+ This will cause some programs (like "w" or "rwho")
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -185,7 +185,7 @@
+ the invoking shell to the application (emacs in this case), because it is
+ forked from the parent screen process, not from the invoking shell.
+
+-If @file{/etc/utmp} is writable by @code{screen}, an appropriate record
++If @file{/run/utmp} is writable by @code{screen}, an appropriate record
+ will be written to this file for each window, and removed when the
+ window is closed. This is useful for working with @code{talk},
+ @code{script}, @code{shutdown}, @code{rsend}, @code{sccs} and other
+@@ -314,7 +314,7 @@
+
+ @item -l
+ @itemx -ln
+-Turn login mode on or off (for @file{/etc/utmp} updating). This option
++Turn login mode on or off (for @file{/run/utmp} updating). This option
+ is equivalent to the @code{deflogin} command (@pxref{Login}).
+
+ @item -ls [@var{match}]
+@@ -497,7 +497,7 @@
+ @cindex screenrc
+ When @code{screen} is invoked, it executes initialization commands from
+ the files @file{.screenrc} in the user's home directory and
+-@file{/usr/local/etc/screenrc}. These defaults can be overridden in the
++@file{/etc/screenrc}. These defaults can be overridden in the
+ following ways:
+ For the global screenrc file @code{screen} searches for the environment
+ variable @code{$SYSSCREENRC} (this override feature may be disabled at
+@@ -1089,7 +1089,7 @@
+ @item logfile @var{filename}
+ Place where to collect logfiles. @xref{Log}.
+ @item login [@var{state}]
+-Log the window in @file{/etc/utmp}. @xref{Login}.
++Log the window in @file{/run/utmp}. @xref{Login}.
+ @item logtstamp [@var{state}]
+ Configure logfile time-stamps. @xref{Log}.
+ @item mapdefault
+@@ -2405,7 +2405,7 @@
+ * Naming Windows:: Control the name of the window
+ * Console:: See the host's console messages
+ * Kill:: Destroy an unwanted window
+-* Login:: Control @file{/etc/utmp} logging
++* Login:: Control @file{/run/utmp} logging
+ * Mode:: Control the file mode of the pty
+ * Monitor:: Watch for activity or inactivity in a window
+ * Windows:: List the active windows
+@@ -2614,7 +2614,7 @@
+ @kindex L
+ @deffn Command login [state]
+ (@kbd{C-a L})@*
+-Adds or removes the entry in @file{/etc/utmp} for the current window.
++Adds or removes the entry in @file{/run/utmp} for the current window.
+ This controls whether or not the window is @dfn{logged in}. In addition
+ to this toggle, it is convenient to have ``log in'' and ``log out''
+ keys. For instance, @code{bind I login on} and @code{bind O
+@@ -5805,17 +5805,17 @@
+ global initialization files.
+
+ @item @code{$SYSSCREENRC}
+-@itemx /local/etc/screenrc
++@itemx /etc/screenrc
+ @code{screen} initialization commands
+
+ @item @code{$SCREENRC}
+ @itemx @code{$HOME}/.iscreenrc
+ @itemx @code{$HOME}/.screenrc
+-Read in after /local/etc/screenrc
++Read in after /etc/screenrc
+
+ @item @code{$SCREENDIR}/S-@var{login}
+
+-@item /local/screens/S-@var{login}
++@item /run/screen/S-@var{login}
+ Socket directories (default)
+
+ @item /usr/tmp/screens/S-@var{login}
+@@ -5838,7 +5838,7 @@
+ @itemx /etc/termcap
+ Terminal capability databases
+
+-@item /etc/utmp
++@item /run/utmp
+ Login records
+
+ @item @code{$LOCKPRG}
+@@ -5950,10 +5950,10 @@
+ in order to be able to
+ correctly change the owner of the tty device file for each window.
+ Special permission may also be required to write the file
+-@file{/etc/utmp}.
++@file{/run/utmp}.
+
+ @item
+-Entries in @file{/etc/utmp} are not removed when @code{screen} is killed
++Entries in @file{/run/utmp} are not removed when @code{screen} is killed
+ with SIGKILL. This will cause some programs (like "w" or "rwho") to
+ advertise that a user is logged on who really isn't.
+
+@@ -6033,7 +6033,7 @@
+ @cindex socket directory
+
+ The socket directory defaults either to @file{$HOME/.screen} or simply to
+-@file{/tmp/screens} or preferably to @file{/usr/local/screens} chosen at
++@file{/tmp/screens} or preferably to @file{/run/screen} chosen at
+ compile-time. If @code{screen} is installed
+ setuid root, then the administrator should compile screen with an
+ adequate (not NFS mounted) @code{SOCKDIR}. If @code{screen} is not
diff --git a/debian/patches/13split_info_files.patch b/debian/patches/13split_info_files.patch
new file mode 100644
index 0000000..c2f0d83
--- /dev/null
+++ b/debian/patches/13split_info_files.patch
@@ -0,0 +1,17 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Split the info files at 50k
+ This matches the distribution style of the orig tarball.
+Last-Revised: 2013-05-16 by Axel Beckert <abe@debian.org>
+Bug-Debian: https://bugs.debian.org/707530
+
+--- a/doc/Makefile.in
++++ b/doc/Makefile.in
+@@ -28,7 +28,7 @@
+
+ info screen.info: screen.texinfo
+ @rm -f screen.info*
+- $(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info
++ $(MAKEINFO) --split-size=50000 $(srcdir)/screen.texinfo -o screen.info
+
+ install: installdirs
+ $(INSTALL_DATA) $(srcdir)/screen.1 $(DESTDIR)$(mandir)/man1/screen.1
diff --git a/debian/patches/26source_encoding.patch b/debian/patches/26source_encoding.patch
new file mode 100644
index 0000000..5ede1cd
--- /dev/null
+++ b/debian/patches/26source_encoding.patch
@@ -0,0 +1,357 @@
+Author: Ben Finney <ben@benfinney.id.au>
+Description: Replace the composed characters with their respective description.
+Bugs-Debian: https://bugs.debian.org/437024
+
+Index: screen/process.c
+===================================================================
+--- screen.orig/process.c 2015-06-13 23:33:02.469345223 +0200
++++ screen/process.c 2015-06-13 23:33:02.469345223 +0200
+@@ -252,177 +252,177 @@
+
+ /* digraph table taken from old vim and rfc1345 */
+ static struct digraph digraphs[MAX_DIGRAPH + 1] = {
+- {{' ', ' '}, 160}, /*   */
+- {{'N', 'S'}, 160}, /*   */
+- {{'~', '!'}, 161}, /* ¡ */
+- {{'!', '!'}, 161}, /* ¡ */
+- {{'!', 'I'}, 161}, /* ¡ */
+- {{'c', '|'}, 162}, /* ¢ */
+- {{'c', 't'}, 162}, /* ¢ */
+- {{'$', '$'}, 163}, /* £ */
+- {{'P', 'd'}, 163}, /* £ */
+- {{'o', 'x'}, 164}, /* ¤ */
+- {{'C', 'u'}, 164}, /* ¤ */
+- {{'C', 'u'}, 164}, /* ¤ */
+- {{'E', 'u'}, 164}, /* ¤ */
+- {{'Y', '-'}, 165}, /* ¥ */
+- {{'Y', 'e'}, 165}, /* ¥ */
+- {{'|', '|'}, 166}, /* ¦ */
+- {{'B', 'B'}, 166}, /* ¦ */
+- {{'p', 'a'}, 167}, /* § */
+- {{'S', 'E'}, 167}, /* § */
+- {{'"', '"'}, 168}, /* ¨ */
+- {{'\'', ':'}, 168}, /* ¨ */
+- {{'c', 'O'}, 169}, /* © */
+- {{'C', 'o'}, 169}, /* © */
+- {{'a', '-'}, 170}, /* ª */
+- {{'<', '<'}, 171}, /* « */
+- {{'-', ','}, 172}, /* ¬ */
+- {{'N', 'O'}, 172}, /* ¬ */
+- {{'-', '-'}, 173}, /* ­ */
+- {{'r', 'O'}, 174}, /* ® */
+- {{'R', 'g'}, 174}, /* ® */
+- {{'-', '='}, 175}, /* ¯ */
+- {{'\'', 'm'}, 175}, /* ¯ */
+- {{'~', 'o'}, 176}, /* ° */
+- {{'D', 'G'}, 176}, /* ° */
+- {{'+', '-'}, 177}, /* ± */
+- {{'2', '2'}, 178}, /* ² */
+- {{'2', 'S'}, 178}, /* ² */
+- {{'3', '3'}, 179}, /* ³ */
+- {{'3', 'S'}, 179}, /* ³ */
+- {{'\'', '\''}, 180}, /* ´ */
+- {{'j', 'u'}, 181}, /* µ */
+- {{'M', 'y'}, 181}, /* µ */
+- {{'p', 'p'}, 182}, /* ¶ */
+- {{'P', 'I'}, 182}, /* ¶ */
+- {{'~', '.'}, 183}, /* · */
+- {{'.', 'M'}, 183}, /* · */
+- {{',', ','}, 184}, /* ¸ */
+- {{'\'', ','}, 184}, /* ¸ */
+- {{'1', '1'}, 185}, /* ¹ */
+- {{'1', 'S'}, 185}, /* ¹ */
+- {{'o', '-'}, 186}, /* º */
+- {{'>', '>'}, 187}, /* » */
+- {{'1', '4'}, 188}, /* ¼ */
+- {{'1', '2'}, 189}, /* ½ */
+- {{'3', '4'}, 190}, /* ¾ */
+- {{'~', '?'}, 191}, /* ¿ */
+- {{'?', '?'}, 191}, /* ¿ */
+- {{'?', 'I'}, 191}, /* ¿ */
+- {{'A', '`'}, 192}, /* À */
+- {{'A', '!'}, 192}, /* À */
+- {{'A', '\''}, 193}, /* Á */
+- {{'A', '^'}, 194}, /* Â */
+- {{'A', '>'}, 194}, /* Â */
+- {{'A', '~'}, 195}, /* Ã */
+- {{'A', '?'}, 195}, /* Ã */
+- {{'A', '"'}, 196}, /* Ä */
+- {{'A', ':'}, 196}, /* Ä */
+- {{'A', '@'}, 197}, /* Å */
+- {{'A', 'A'}, 197}, /* Å */
+- {{'A', 'E'}, 198}, /* Æ */
+- {{'C', ','}, 199}, /* Ç */
+- {{'E', '`'}, 200}, /* È */
+- {{'E', '!'}, 200}, /* È */
+- {{'E', '\''}, 201}, /* É */
+- {{'E', '^'}, 202}, /* Ê */
+- {{'E', '>'}, 202}, /* Ê */
+- {{'E', '"'}, 203}, /* Ë */
+- {{'E', ':'}, 203}, /* Ë */
+- {{'I', '`'}, 204}, /* Ì */
+- {{'I', '!'}, 204}, /* Ì */
+- {{'I', '\''}, 205}, /* Í */
+- {{'I', '^'}, 206}, /* Î */
+- {{'I', '>'}, 206}, /* Î */
+- {{'I', '"'}, 207}, /* Ï */
+- {{'I', ':'}, 207}, /* Ï */
+- {{'D', '-'}, 208}, /* Ð */
+- {{'N', '~'}, 209}, /* Ñ */
+- {{'N', '?'}, 209}, /* Ñ */
+- {{'O', '`'}, 210}, /* Ò */
+- {{'O', '!'}, 210}, /* Ò */
+- {{'O', '\''}, 211}, /* Ó */
+- {{'O', '^'}, 212}, /* Ô */
+- {{'O', '>'}, 212}, /* Ô */
+- {{'O', '~'}, 213}, /* Õ */
+- {{'O', '?'}, 213}, /* Õ */
+- {{'O', '"'}, 214}, /* Ö */
+- {{'O', ':'}, 214}, /* Ö */
+- {{'/', '\\'}, 215}, /* × */
+- {{'*', 'x'}, 215}, /* × */
+- {{'O', '/'}, 216}, /* Ø */
+- {{'U', '`'}, 217}, /* Ù */
+- {{'U', '!'}, 217}, /* Ù */
+- {{'U', '\''}, 218}, /* Ú */
+- {{'U', '^'}, 219}, /* Û */
+- {{'U', '>'}, 219}, /* Û */
+- {{'U', '"'}, 220}, /* Ü */
+- {{'U', ':'}, 220}, /* Ü */
+- {{'Y', '\''}, 221}, /* Ý */
+- {{'I', 'p'}, 222}, /* Þ */
+- {{'T', 'H'}, 222}, /* Þ */
+- {{'s', 's'}, 223}, /* ß */
+- {{'s', '"'}, 223}, /* ß */
+- {{'a', '`'}, 224}, /* à */
+- {{'a', '!'}, 224}, /* à */
+- {{'a', '\''}, 225}, /* á */
+- {{'a', '^'}, 226}, /* â */
+- {{'a', '>'}, 226}, /* â */
+- {{'a', '~'}, 227}, /* ã */
+- {{'a', '?'}, 227}, /* ã */
+- {{'a', '"'}, 228}, /* ä */
+- {{'a', ':'}, 228}, /* ä */
+- {{'a', 'a'}, 229}, /* å */
+- {{'a', 'e'}, 230}, /* æ */
+- {{'c', ','}, 231}, /* ç */
+- {{'e', '`'}, 232}, /* è */
+- {{'e', '!'}, 232}, /* è */
+- {{'e', '\''}, 233}, /* é */
+- {{'e', '^'}, 234}, /* ê */
+- {{'e', '>'}, 234}, /* ê */
+- {{'e', '"'}, 235}, /* ë */
+- {{'e', ':'}, 235}, /* ë */
+- {{'i', '`'}, 236}, /* ì */
+- {{'i', '!'}, 236}, /* ì */
+- {{'i', '\''}, 237}, /* í */
+- {{'i', '^'}, 238}, /* î */
+- {{'i', '>'}, 238}, /* î */
+- {{'i', '"'}, 239}, /* ï */
+- {{'i', ':'}, 239}, /* ï */
+- {{'d', '-'}, 240}, /* ð */
+- {{'n', '~'}, 241}, /* ñ */
+- {{'n', '?'}, 241}, /* ñ */
+- {{'o', '`'}, 242}, /* ò */
+- {{'o', '!'}, 242}, /* ò */
+- {{'o', '\''}, 243}, /* ó */
+- {{'o', '^'}, 244}, /* ô */
+- {{'o', '>'}, 244}, /* ô */
+- {{'o', '~'}, 245}, /* õ */
+- {{'o', '?'}, 245}, /* õ */
+- {{'o', '"'}, 246}, /* ö */
+- {{'o', ':'}, 246}, /* ö */
+- {{':', '-'}, 247}, /* ÷ */
+- {{'o', '/'}, 248}, /* ø */
+- {{'u', '`'}, 249}, /* ù */
+- {{'u', '!'}, 249}, /* ù */
+- {{'u', '\''}, 250}, /* ú */
+- {{'u', '^'}, 251}, /* û */
+- {{'u', '>'}, 251}, /* û */
+- {{'u', '"'}, 252}, /* ü */
+- {{'u', ':'}, 252}, /* ü */
+- {{'y', '\''}, 253}, /* ý */
+- {{'i', 'p'}, 254}, /* þ */
+- {{'t', 'h'}, 254}, /* þ */
+- {{'y', '"'}, 255}, /* ÿ */
+- {{'y', ':'}, 255}, /* ÿ */
+- {{'"', '['}, 196}, /* Ä */
+- {{'"', '\\'}, 214}, /* Ö */
+- {{'"', ']'}, 220}, /* Ü */
+- {{'"', '{'}, 228}, /* ä */
+- {{'"', '|'}, 246}, /* ö */
+- {{'"', '}'}, 252}, /* ü */
+- {{'"', '~'}, 223} /* ß */
++ {{' ', ' '}, 0x00a0}, /* NO-BREAK SPACE */
++ {{'N', 'S'}, 0x00a0}, /* NO-BREAK SPACE */
++ {{'~', '!'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'!', '!'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'!', 'I'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'c', '|'}, 0x00a2}, /* CENT SIGN */
++ {{'c', 't'}, 0x00a2}, /* CENT SIGN */
++ {{'$', '$'}, 0x00a3}, /* POUND SIGN */
++ {{'P', 'd'}, 0x00a3}, /* POUND SIGN */
++ {{'o', 'x'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'C', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'C', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'E', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'Y', '-'}, 0x00a5}, /* YEN SIGN */
++ {{'Y', 'e'}, 0x00a5}, /* YEN SIGN */
++ {{'|', '|'}, 0x00a6}, /* BROKEN BAR */
++ {{'B', 'B'}, 0x00a6}, /* BROKEN BAR */
++ {{'p', 'a'}, 0x00a7}, /* SECTION SIGN */
++ {{'S', 'E'}, 0x00a7}, /* SECTION SIGN */
++ {{'"', '"'}, 0x00a8}, /* DIAERESIS */
++ {{'\'', ':'}, 0x00a8}, /* DIAERESIS */
++ {{'c', 'O'}, 0x00a9}, /* COPYRIGHT SIGN */
++ {{'C', 'o'}, 0x00a9}, /* COPYRIGHT SIGN */
++ {{'-', 'a'}, 0x00aa}, /* FEMININE ORDINAL INDICATOR */
++ {{'<', '<'}, 0x00ab}, /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
++ {{'-', ','}, 0x00ac}, /* NOT SIGN */
++ {{'N', 'O'}, 0x00ac}, /* NOT SIGN */
++ {{'-', '-'}, 0x00ad}, /* SOFT HYPHEN */
++ {{'r', 'O'}, 0x00ae}, /* REGISTERED SIGN */
++ {{'R', 'g'}, 0x00ae}, /* REGISTERED SIGN */
++ {{'-', '='}, 0x00af}, /* MACRON */
++ {{'\'', 'm'}, 0x00af}, /* MACRON */
++ {{'~', 'o'}, 0x00b0}, /* DEGREE SIGN */
++ {{'D', 'G'}, 0x00b0}, /* DEGREE SIGN */
++ {{'+', '-'}, 0x00b1}, /* PLUS-MINUS SIGN */
++ {{'2', '2'}, 0x00b2}, /* SUPERSCRIPT TWO */
++ {{'2', 'S'}, 0x00b2}, /* SUPERSCRIPT TWO */
++ {{'3', '3'}, 0x00b3}, /* SUPERSCRIPT THREE */
++ {{'3', 'S'}, 0x00b3}, /* SUPERSCRIPT THREE */
++ {{'\'', '\''}, 0x00b4}, /* ACUTE ACCENT */
++ {{'j', 'u'}, 0x00b5}, /* MICRO SIGN */
++ {{'M', 'y'}, 0x00b5}, /* MICRO SIGN */
++ {{'p', 'p'}, 0x00b6}, /* PILCROW SIGN */
++ {{'P', 'I'}, 0x00b6}, /* PILCROW SIGN */
++ {{'~', '.'}, 0x00b7}, /* MIDDLE DOT */
++ {{'.', 'M'}, 0x00b7}, /* MIDDLE DOT */
++ {{',', ','}, 0x00b8}, /* CEDILLA */
++ {{'\'', ','}, 0x00b8}, /* CEDILLA */
++ {{'1', '1'}, 0x00b9}, /* SUPERSCRIPT ONE */
++ {{'1', 'S'}, 0x00b9}, /* SUPERSCRIPT ONE */
++ {{'-', 'o'}, 0x00ba}, /* MASCULINE ORDINAL INDICATOR */
++ {{'>', '>'}, 0x00bb}, /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
++ {{'1', '4'}, 0x00bc}, /* VULGAR FRACTION ONE QUARTER */
++ {{'1', '2'}, 0x00bd}, /* VULGAR FRACTION ONE HALF */
++ {{'3', '4'}, 0x00be}, /* VULGAR FRACTION THREE QUARTERS */
++ {{'~', '?'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'?', '?'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'?', 'I'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'A', '`'}, 0x00c0}, /* LATIN CAPITAL LETTER A WITH GRAVE */
++ {{'A', '!'}, 0x00c0}, /* LATIN CAPITAL LETTER A WITH GRAVE */
++ {{'A', '\''}, 0x00c1}, /* LATIN CAPITAL LETTER A WITH ACUTE */
++ {{'A', '^'}, 0x00c2}, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
++ {{'A', '>'}, 0x00c2}, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
++ {{'A', '~'}, 0x00c3}, /* LATIN CAPITAL LETTER A WITH TILDE */
++ {{'A', '?'}, 0x00c3}, /* LATIN CAPITAL LETTER A WITH TILDE */
++ {{'A', '"'}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'A', ':'}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'A', '@'}, 0x00c5}, /* LATIN CAPITAL LETTER A WITH RING ABOVE */
++ {{'A', 'A'}, 0x00c5}, /* LATIN CAPITAL LETTER A WITH RING ABOVE */
++ {{'A', 'E'}, 0x00c6}, /* LATIN CAPITAL LETTER AE */
++ {{'C', ','}, 0x00c7}, /* LATIN CAPITAL LETTER C WITH CEDILLA */
++ {{'E', '`'}, 0x00c8}, /* LATIN CAPITAL LETTER E WITH GRAVE */
++ {{'E', '!'}, 0x00c8}, /* LATIN CAPITAL LETTER E WITH GRAVE */
++ {{'E', '\''}, 0x00c9}, /* LATIN CAPITAL LETTER E WITH ACUTE */
++ {{'E', '^'}, 0x00ca}, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
++ {{'E', '>'}, 0x00ca}, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
++ {{'E', '"'}, 0x00cb}, /* LATIN CAPITAL LETTER E WITH DIAERESIS */
++ {{'E', ':'}, 0x00cb}, /* LATIN CAPITAL LETTER E WITH DIAERESIS */
++ {{'I', '`'}, 0x00cc}, /* LATIN CAPITAL LETTER I WITH GRAVE */
++ {{'I', '!'}, 0x00cc}, /* LATIN CAPITAL LETTER I WITH GRAVE */
++ {{'I', '\''}, 0x00cd}, /* LATIN CAPITAL LETTER I WITH ACUTE */
++ {{'I', '^'}, 0x00ce}, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
++ {{'I', '>'}, 0x00ce}, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
++ {{'I', '"'}, 0x00cf}, /* LATIN CAPITAL LETTER I WITH DIAERESIS */
++ {{'I', ':'}, 0x00cf}, /* LATIN CAPITAL LETTER I WITH DIAERESIS */
++ {{'D', '-'}, 0x00d0}, /* LATIN CAPITAL LETTER ETH */
++ {{'N', '~'}, 0x00d1}, /* LATIN CAPITAL LETTER N WITH TILDE */
++ {{'N', '?'}, 0x00d1}, /* LATIN CAPITAL LETTER N WITH TILDE */
++ {{'O', '`'}, 0x00d2}, /* LATIN CAPITAL LETTER O WITH GRAVE */
++ {{'O', '!'}, 0x00d2}, /* LATIN CAPITAL LETTER O WITH GRAVE */
++ {{'O', '\''}, 0x00d3}, /* LATIN CAPITAL LETTER O WITH ACUTE */
++ {{'O', '^'}, 0x00d4}, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
++ {{'O', '>'}, 0x00d4}, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
++ {{'O', '~'}, 0x00d5}, /* LATIN CAPITAL LETTER O WITH TILDE */
++ {{'O', '?'}, 0x00d5}, /* LATIN CAPITAL LETTER O WITH TILDE */
++ {{'O', '"'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'O', ':'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'/', '\\'}, 0x00d7}, /* MULTIPLICATION SIGN */
++ {{'*', 'x'}, 0x00d7}, /* MULTIPLICATION SIGN */
++ {{'O', '/'}, 0x00d8}, /* LATIN CAPITAL LETTER O WITH STROKE */
++ {{'U', '`'}, 0x00d9}, /* LATIN CAPITAL LETTER U WITH GRAVE */
++ {{'U', '!'}, 0x00d9}, /* LATIN CAPITAL LETTER U WITH GRAVE */
++ {{'U', '\''}, 0x00da}, /* LATIN CAPITAL LETTER U WITH ACUTE */
++ {{'U', '^'}, 0x00db}, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
++ {{'U', '>'}, 0x00db}, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
++ {{'U', '"'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'U', ':'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'Y', '\''}, 0x00dd}, /* LATIN CAPITAL LETTER Y WITH ACUTE */
++ {{'I', 'p'}, 0x00de}, /* LATIN CAPITAL LETTER THORN */
++ {{'T', 'H'}, 0x00de}, /* LATIN CAPITAL LETTER THORN */
++ {{'s', 's'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
++ {{'s', '"'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
++ {{'a', '`'}, 0x00e0}, /* LATIN SMALL LETTER A WITH GRAVE */
++ {{'a', '!'}, 0x00e0}, /* LATIN SMALL LETTER A WITH GRAVE */
++ {{'a', '\''}, 0x00e1}, /* LATIN SMALL LETTER A WITH ACUTE */
++ {{'a', '^'}, 0x00e2}, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */
++ {{'a', '>'}, 0x00e2}, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */
++ {{'a', '~'}, 0x00e3}, /* LATIN SMALL LETTER A WITH TILDE */
++ {{'a', '?'}, 0x00e3}, /* LATIN SMALL LETTER A WITH TILDE */
++ {{'a', '"'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'a', ':'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'a', 'a'}, 0x00e5}, /* LATIN SMALL LETTER A WITH RING ABOVE */
++ {{'a', 'e'}, 0x00e6}, /* LATIN SMALL LETTER AE */
++ {{'c', ','}, 0x00e7}, /* LATIN SMALL LETTER C WITH CEDILLA */
++ {{'e', '`'}, 0x00e8}, /* LATIN SMALL LETTER E WITH GRAVE */
++ {{'e', '!'}, 0x00e8}, /* LATIN SMALL LETTER E WITH GRAVE */
++ {{'e', '\''}, 0x00e9}, /* LATIN SMALL LETTER E WITH ACUTE */
++ {{'e', '^'}, 0x00ea}, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */
++ {{'e', '>'}, 0x00ea}, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */
++ {{'e', '"'}, 0x00eb}, /* LATIN SMALL LETTER E WITH DIAERESIS */
++ {{'e', ':'}, 0x00eb}, /* LATIN SMALL LETTER E WITH DIAERESIS */
++ {{'i', '`'}, 0x00ec}, /* LATIN SMALL LETTER I WITH GRAVE */
++ {{'i', '!'}, 0x00ec}, /* LATIN SMALL LETTER I WITH GRAVE */
++ {{'i', '\''}, 0x00ed}, /* LATIN SMALL LETTER I WITH ACUTE */
++ {{'i', '^'}, 0x00ee}, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */
++ {{'i', '>'}, 0x00ee}, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */
++ {{'i', '"'}, 0x00ef}, /* LATIN SMALL LETTER I WITH DIAERESIS */
++ {{'i', ':'}, 0x00ef}, /* LATIN SMALL LETTER I WITH DIAERESIS */
++ {{'d', '-'}, 0x00f0}, /* LATIN SMALL LETTER ETH */
++ {{'n', '~'}, 0x00f1}, /* LATIN SMALL LETTER N WITH TILDE */
++ {{'n', '?'}, 0x00f1}, /* LATIN SMALL LETTER N WITH TILDE */
++ {{'o', '`'}, 0x00f2}, /* LATIN SMALL LETTER O WITH GRAVE */
++ {{'o', '!'}, 0x00f2}, /* LATIN SMALL LETTER O WITH GRAVE */
++ {{'o', '\''}, 0x00f3}, /* LATIN SMALL LETTER O WITH ACUTE */
++ {{'o', '^'}, 0x00f4}, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */
++ {{'o', '>'}, 0x00f4}, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */
++ {{'o', '~'}, 0x00f5}, /* LATIN SMALL LETTER O WITH TILDE */
++ {{'o', '?'}, 0x00f5}, /* LATIN SMALL LETTER O WITH TILDE */
++ {{'o', '"'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'o', ':'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'-', ':'}, 0x00f7}, /* DIVISION SIGN */
++ {{'o', '/'}, 0x00f8}, /* LATIN SMALL LETTER O WITH STROKE */
++ {{'u', '`'}, 0x00f9}, /* LATIN SMALL LETTER U WITH GRAVE */
++ {{'u', '!'}, 0x00f9}, /* LATIN SMALL LETTER U WITH GRAVE */
++ {{'u', '\''}, 0x00fa}, /* LATIN SMALL LETTER U WITH ACUTE */
++ {{'u', '^'}, 0x00fb}, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */
++ {{'u', '>'}, 0x00fb}, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */
++ {{'u', '"'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'u', ':'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'y', '\''}, 0x00fd}, /* LATIN SMALL LETTER Y WITH ACUTE */
++ {{'i', 'p'}, 0x00fe}, /* LATIN SMALL LETTER THORN */
++ {{'t', 'h'}, 0x00fe}, /* LATIN SMALL LETTER THORN */
++ {{'y', '"'}, 0x00ff}, /* LATIN SMALL LETTER Y WITH DIAERESIS */
++ {{'y', ':'}, 0x00ff}, /* LATIN SMALL LETTER Y WITH DIAERESIS */
++ {{'"', '['}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'"', '\\'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'"', ']'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'"', '{'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'"', '|'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'"', '}'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'"', '~'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
+ };
+
+ #define RESIZE_FLAG_H 1
diff --git a/debian/patches/45suppress_remap.patch b/debian/patches/45suppress_remap.patch
new file mode 100644
index 0000000..d705c59
--- /dev/null
+++ b/debian/patches/45suppress_remap.patch
@@ -0,0 +1,15 @@
+Author: Loic Minier <lool@dooz.org>
+Description: Unbreak several useful keybindings.
+Bugs-Debian: https://bugs.debian.org/484647
+
+--- a/termcap.c
++++ b/termcap.c
+@@ -553,8 +553,6 @@
+ else
+ break;
+ }
+- if (n < KMAP_KEYS)
+- domap = 1;
+ if (map == 0 && domap)
+ return 0;
+ if (map && !domap)
diff --git a/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch b/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch
new file mode 100644
index 0000000..f1159b1
--- /dev/null
+++ b/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch
@@ -0,0 +1,57 @@
+Description: Patch to make 4.2.1 compatible with Debian's 4.1.0 and
+ 4.2.0 packages 4.2.1 includes the Debian patches to extend the login
+ name and $TERM length, but uses even larger values. This causes
+ screen clients to no more be able to talk to older screen
+ servers. See #644788 for a discussion of the same issue with earlier
+ release combinations (4.1.0 vs 4.0.3).
+ .
+ For now this patch sets the mentioned values back to those which
+ werew in use in Debian before (and seemed to be large enough for use
+ in Debian).
+Author: Axel Beckert <abe@debian.org>
+Forwarded: not-needed
+
+--- a/os.h
++++ b/os.h
+@@ -524,6 +524,6 @@
+ /* Changing those you won't be able to attach to your old sessions
+ * when changing those values in official tree don't forget to bump
+ * MSG_VERSION */
+-#define MAXTERMLEN 32
+-#define MAXLOGINLEN 256
++#define MAXTERMLEN 40
++#define MAXLOGINLEN 50
+
+--- a/screen.h
++++ b/screen.h
+@@ -186,7 +186,7 @@
+ * 4: screen version 4.2.1 (bumped once again due to changed terminal and login length)
+ * 5: screen version 4.4.0 (fix screenterm size)
+ */
+-#define MSG_VERSION 5
++#define MSG_VERSION 2
+
+ #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION)
+ struct msg
+@@ -205,7 +205,7 @@
+ int nargs;
+ char line[MAXPATHLEN];
+ char dir[MAXPATHLEN];
+- char screenterm[MAXTERMLEN + 1]; /* is screen really "screen" ? */
++ char screenterm[20]; /* is screen really "screen" ? */
+ }
+ create;
+ struct
+--- a/socket.c
++++ b/socket.c
+@@ -723,8 +723,8 @@
+ goto end;
+ }
+ if (nwin->term != nwin_undef.term)
+- strncpy(m.m.create.screenterm, nwin->term, MAXTERMLEN);
+- m.m.create.screenterm[MAXTERMLEN] = '\0';
++ strncpy(m.m.create.screenterm, nwin->term, 20-1);
++ m.m.create.screenterm[20-1] = '\0';
+ m.protocol_revision = MSG_REVISION;
+ debug1("SendCreateMsg writing '%s'\n", m.m.create.line);
+ if (write(s, (char *) &m, sizeof m) != sizeof m)
diff --git a/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch b/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch
new file mode 100644
index 0000000..4f81703
--- /dev/null
+++ b/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch
@@ -0,0 +1,38 @@
+Description: Set PATH_MAX to 4096 if undefined
+ Fixes FTBFS since 4.4.0 on GNU/Hurd. Updated to add one more occurrence for 4.5.0.
+Author: Axel Beckert <abe@debian.org>
+Bug: https://savannah.gnu.org/bugs/?50089
+Last-Updated: 2017-01-18
+
+--- a/tty.sh
++++ b/tty.sh
+@@ -1478,6 +1478,13 @@
+ return 0;
+ }
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ int CheckTtyname (char *tty)
+ {
+--- a/screen.h
++++ b/screen.h
+@@ -109,6 +109,13 @@
+ # define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
+ #endif
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT))
+ # define HPUX_LTCHARS_HACK
diff --git a/debian/patches/63-add-utempter-switch.patch b/debian/patches/63-add-utempter-switch.patch
new file mode 100644
index 0000000..3f65c2a
--- /dev/null
+++ b/debian/patches/63-add-utempter-switch.patch
@@ -0,0 +1,24 @@
+Description: Add guarding commandline option around libutempter check
+Author: Axel Beckert <abe@debian.org>
+Forwarded: not-yet
+Bug-Debian: https://bugs.debian.org/819781
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -844,6 +844,8 @@
+ ],
+ [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
+ )
++AC_ARG_ENABLE(utempter, [ --enable-utempter enable utempter support])
++if test "$enable_pam" = "yes"; then
+ AC_CHECKING(ut_host)
+ AC_TRY_COMPILE([
+ #include <time.h>
+@@ -860,6 +862,7 @@
+ AC_DEFINE(HAVE_UTEMPTER)
+ LIBS="$LIBS -lutempter"
+ fi
++fi
+
+ dnl
+ dnl **** loadav ****
diff --git a/debian/patches/65-wcwidth.patch b/debian/patches/65-wcwidth.patch
new file mode 100644
index 0000000..e8a118e
--- /dev/null
+++ b/debian/patches/65-wcwidth.patch
@@ -0,0 +1,147 @@
+Description: Use wcwdith instead of a hardcoded list of wide characters
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1027733;filename=screen.wcwidth.v2.patch;msg=80
+Author: Aurelien Jarno <aurelien@aurel32.net>
+Reviewed-By: Axel Beckert <abe@debian.org>
+Bug-Debian: https://bugs.debian.org/1027733
+Forwarded: no
+ (It is currently unclear if this patch is suitable for upstream usage.)
+
+--- screen-4.9.0.orig/encoding.c
++++ screen-4.9.0/encoding.c
+@@ -22,6 +22,7 @@
+ */
+
+ #include <sys/types.h>
++#include <wchar.h>
+
+ #include "config.h"
+ #include "screen.h"
+@@ -1145,127 +1146,10 @@ int c;
+ {0xF0000, 0xFFFFD},
+ {0x100000, 0x10FFFD},
+ };
+- /* A sorted list of intervals of double width characters generated by
+- * https://github.com/GNOME/glib/blob/glib-2-50/glib/gen-unicode-tables.pl */
+- static const struct interval wide[] = {
+- {0x1100, 0x115F},
+- {0x231A, 0x231B},
+- {0x2329, 0x232A},
+- {0x23E9, 0x23EC},
+- {0x23F0, 0x23F0},
+- {0x23F3, 0x23F3},
+- {0x25FD, 0x25FE},
+- {0x2614, 0x2615},
+- {0x2648, 0x2653},
+- {0x267F, 0x267F},
+- {0x2693, 0x2693},
+- {0x26A1, 0x26A1},
+- {0x26AA, 0x26AB},
+- {0x26BD, 0x26BE},
+- {0x26C4, 0x26C5},
+- {0x26CE, 0x26CE},
+- {0x26D4, 0x26D4},
+- {0x26EA, 0x26EA},
+- {0x26F2, 0x26F3},
+- {0x26F5, 0x26F5},
+- {0x26FA, 0x26FA},
+- {0x26FD, 0x26FD},
+- {0x2705, 0x2705},
+- {0x270A, 0x270B},
+- {0x2728, 0x2728},
+- {0x274C, 0x274C},
+- {0x274E, 0x274E},
+- {0x2753, 0x2755},
+- {0x2757, 0x2757},
+- {0x2795, 0x2797},
+- {0x27B0, 0x27B0},
+- {0x27BF, 0x27BF},
+- {0x2B1B, 0x2B1C},
+- {0x2B50, 0x2B50},
+- {0x2B55, 0x2B55},
+- {0x2E80, 0x2E99},
+- {0x2E9B, 0x2EF3},
+- {0x2F00, 0x2FD5},
+- {0x2FF0, 0x2FFB},
+- {0x3000, 0x303E},
+- {0x3041, 0x3096},
+- {0x3099, 0x30FF},
+- {0x3105, 0x312F},
+- {0x3131, 0x318E},
+- {0x3190, 0x31BA},
+- {0x31C0, 0x31E3},
+- {0x31F0, 0x321E},
+- {0x3220, 0x3247},
+- {0x3250, 0x4DBF},
+- {0x4E00, 0xA48C},
+- {0xA490, 0xA4C6},
+- {0xA960, 0xA97C},
+- {0xAC00, 0xD7A3},
+- {0xF900, 0xFAFF},
+- {0xFE10, 0xFE19},
+- {0xFE30, 0xFE52},
+- {0xFE54, 0xFE66},
+- {0xFE68, 0xFE6B},
+- {0xFF01, 0xFF60},
+- {0xFFE0, 0xFFE6},
+- {0x16FE0, 0x16FE3},
+- {0x17000, 0x187F7},
+- {0x18800, 0x18AF2},
+- {0x1B000, 0x1B11E},
+- {0x1B150, 0x1B152},
+- {0x1B164, 0x1B167},
+- {0x1B170, 0x1B2FB},
+- {0x1F004, 0x1F004},
+- {0x1F0CF, 0x1F0CF},
+- {0x1F18E, 0x1F18E},
+- {0x1F191, 0x1F19A},
+- {0x1F200, 0x1F202},
+- {0x1F210, 0x1F23B},
+- {0x1F240, 0x1F248},
+- {0x1F250, 0x1F251},
+- {0x1F260, 0x1F265},
+- {0x1F300, 0x1F320},
+- {0x1F32D, 0x1F335},
+- {0x1F337, 0x1F37C},
+- {0x1F37E, 0x1F393},
+- {0x1F3A0, 0x1F3CA},
+- {0x1F3CF, 0x1F3D3},
+- {0x1F3E0, 0x1F3F0},
+- {0x1F3F4, 0x1F3F4},
+- {0x1F3F8, 0x1F43E},
+- {0x1F440, 0x1F440},
+- {0x1F442, 0x1F4FC},
+- {0x1F4FF, 0x1F53D},
+- {0x1F54B, 0x1F54E},
+- {0x1F550, 0x1F567},
+- {0x1F57A, 0x1F57A},
+- {0x1F595, 0x1F596},
+- {0x1F5A4, 0x1F5A4},
+- {0x1F5FB, 0x1F64F},
+- {0x1F680, 0x1F6C5},
+- {0x1F6CC, 0x1F6CC},
+- {0x1F6D0, 0x1F6D2},
+- {0x1F6D5, 0x1F6D5},
+- {0x1F6EB, 0x1F6EC},
+- {0x1F6F4, 0x1F6FA},
+- {0x1F7E0, 0x1F7EB},
+- {0x1F90D, 0x1F971},
+- {0x1F973, 0x1F976},
+- {0x1F97A, 0x1F9A2},
+- {0x1F9A5, 0x1F9AA},
+- {0x1F9AE, 0x1F9CA},
+- {0x1F9CD, 0x1F9FF},
+- {0x1FA70, 0x1FA73},
+- {0x1FA78, 0x1FA7A},
+- {0x1FA80, 0x1FA82},
+- {0x1FA90, 0x1FA95},
+- {0x20000, 0x2FFFD},
+- {0x30000, 0x3FFFD},
+- };
+
+ if (c >= 0xdf00 && c <= 0xdfff)
+ return 1; /* dw combining sequence */
+- return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
++ return ((wcwidth(c) == 2) ||
+ (cjkwidth &&
+ bisearch(c, ambiguous,
+ sizeof(ambiguous) / sizeof(struct interval) - 1)));
diff --git a/debian/patches/80_session_creation_docs.patch b/debian/patches/80_session_creation_docs.patch
new file mode 100644
index 0000000..ebd50a1
--- /dev/null
+++ b/debian/patches/80_session_creation_docs.patch
@@ -0,0 +1,74 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 1/3: documentation
+Bug-Debian: https://bugs.debian.org/206572
+Forwarded: not-yet
+
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -241,7 +241,7 @@
+ .IR screen ,
+ but prints a list of
+ .I pid.tty.host
+-strings identifying your
++strings and creation timestamps identifying your
+ .I screen
+ sessions.
+ Sessions marked `detached' can be resumed with \*Qscreen \-r\*U. Those marked
+@@ -348,7 +348,7 @@
+ .I screen
+ is detached. Otherwise lists available sessions.
+ .B \-RR
+-attempts to resume the first detached
++attempts to resume the youngest (in terms of creation time) detached
+ .I screen
+ session it finds. If successful, all other command-line options are ignored.
+ If no detached session exists, starts a new session using the specified
+@@ -358,6 +358,8 @@
+ .I screen
+ is run as a login-shell (actually screen uses \*Q\-xRR\*U in that case).
+ For combinations with the \fB\-d\fP/\fB\-D\fP option see there.
++.B Note:
++Time-based session selection is a Debian addition.
+ .TP 5
+ .BI "\-s " program
+ sets the default shell to the program specified, instead of the value
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -321,7 +321,8 @@
+ @itemx -list [@var{match}]
+ Do not start @code{screen}, but instead print a list of session
+ identification strings (usually of the form @var{pid.tty.host};
+-@pxref{Session Name}). Sessions marked @samp{detached} can be resumed
++@pxref{Session Name}) and the corresponding creation timestamps.
++Sessions marked @samp{detached} can be resumed
+ with @code{screen -r}. Those marked @samp{attached} are running and
+ have a controlling terminal. If the session runs in multiuser mode,
+ it is marked @samp{multi}. Sessions marked as @samp{unreachable} either
+@@ -415,14 +416,15 @@
+ when only one @code{screen} is detached. Otherwise lists available sessions.
+
+ @item -RR
+-Resume the first appropriate detached @code{screen} session. If
+-successful, all other command-line options are ignored. If no detached
++Resume the most-recently created appropriate detached @code{screen} session.
++If successful, all other command-line options are ignored. If no detached
+ session exists, start a new session using the specified options, just as
+ if @samp{-R} had not been specified. This option is set by default if
+ screen is run as a login-shell (actually screen uses @samp{-xRR} in
+ that case).
+ For combinations with the
+ @samp{-D}/@samp{-d} option see there.
++@samp{Note:} Time-based session selection is a Debian addition.
+
+ @item -s @var{program}
+ Set the default shell to be @var{program}. By default, @code{screen}
diff --git a/debian/patches/81_session_creation_util.patch b/debian/patches/81_session_creation_util.patch
new file mode 100644
index 0000000..318d3b0
--- /dev/null
+++ b/debian/patches/81_session_creation_util.patch
@@ -0,0 +1,77 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 2/3: new utility functions
+Bug-Debian: https://bugs.debian.org/206572
+Forwarded: not-yet
+
+--- a/extern.h
++++ b/extern.h
+@@ -395,6 +395,8 @@
+ #else
+ extern int xsnprintf __P(());
+ #endif
++extern time_t SessionCreationTime __P((const char *));
++extern time_t GetUptime __P((void));
+
+
+ /* acl.c */
+--- a/misc.c
++++ b/misc.c
+@@ -30,6 +30,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h> /* mkdir() declaration */
+ #include <signal.h>
++#include <fcntl.h>
+
+ #include "config.h"
+ #include "screen.h"
+@@ -796,3 +797,40 @@
+ }
+
+ #endif
++
++time_t SessionCreationTime(const char *fifo) {
++ char ppath[20];
++ int pfd;
++ char pdata[512];
++ char *jiffies;
++
++ int pid = atoi(fifo);
++ if (pid <= 0) return 0;
++ sprintf(ppath, "/proc/%u/stat", pid);
++ pfd = open(ppath, O_RDONLY);
++ if (pfd < 0) return 0;
++ while (1) {
++ int R=0, RR;
++ RR = read(pfd, pdata + R, 512-R);
++ if (RR < 0) {close(pfd); return 0;}
++ else if (RR == 0) break;
++ }
++ close(pfd);
++
++ for (pfd=21, jiffies=pdata; pfd; --pfd) {
++ jiffies = strchr(jiffies, ' ');
++ if (!jiffies) break; else ++jiffies;
++ }
++ if (!jiffies) return 0;
++
++ return atol(jiffies) / 100;
++}
++
++time_t GetUptime(void) {
++ char uptimestr[32];
++ int fd = open("/proc/uptime", O_RDONLY);
++ if (fd < 0) return 0;
++ (void)read(fd, uptimestr, 32);
++ close(fd);
++ return atol(uptimestr);
++}
diff --git a/debian/patches/82_session_creation_core.patch b/debian/patches/82_session_creation_core.patch
new file mode 100644
index 0000000..72fa1f3
--- /dev/null
+++ b/debian/patches/82_session_creation_core.patch
@@ -0,0 +1,161 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 3/3: implementation of actual new feature
+Bug-Debian: https://bugs.debian.org/206572
+Bug-Debian: https://bugs.debian.org/507817
+Forwarded: not-yet
+
+--- a/socket.c
++++ b/socket.c
+@@ -137,16 +137,18 @@
+ int sdirlen;
+ int matchlen = 0;
+ char *name, *n;
+- int firsts = -1, sockfd;
+- char *firstn = NULL;
++ int sockfd;
+ int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0;
+ int nperfect = 0;
++ time_t time_sysboot = time(NULL) - GetUptime();
+ struct sent
+ {
+ struct sent *next;
+ int mode;
++ int fd;
+ char *name;
+- } *slist, **slisttail, *sent, *nsent;
++ time_t time_created;
++ } *slist, **slisttail, *sent, *nsent, *schosen;
+
+ if (match)
+ {
+@@ -172,7 +174,7 @@
+ if ((dirp = opendir(SockPath)) == 0)
+ Panic(errno, "Cannot opendir %s", SockPath);
+
+- slist = 0;
++ slist = schosen = NULL;
+ slisttail = &slist;
+ while ((dp = readdir(dirp)))
+ {
+@@ -255,13 +257,16 @@
+ debug(" store it.\n");
+ if ((sent = (struct sent *)malloc(sizeof(struct sent))) == 0)
+ continue;
+- sent->next = 0;
+ sent->name = SaveStr(name);
+ sent->mode = mode;
++ sent->time_created = time_sysboot + SessionCreationTime(name);
++ for (slisttail = &slist; *slisttail; slisttail = &((*slisttail)->next)) {
++ if ((*slisttail)->time_created < sent->time_created) break;
++ }
++ sent->next = *slisttail;
+ *slisttail = sent;
+- slisttail = &sent->next;
+ nfound++;
+- sockfd = MakeClientSocket(0, *is_sock);
++ sent->fd = sockfd = MakeClientSocket(0, *is_sock);
+ #ifdef USE_SETEUID
+ /* MakeClientSocket sets ids back to eff */
+ xseteuid(real_uid);
+@@ -326,12 +331,17 @@
+ ngood++;
+ if (cmatch)
+ nperfect++;
+- if (fdp && (firsts == -1 || (cmatch && nperfect == 1)))
++ // prefer the current one if one of the following is true:
++ // - we had no previous hit
++ // - the current one has a later timestamp than our previous one, and we haven't found a perfect match yet
++ // - this one is the first perfect match
++ if (fdp && (!schosen ||
++ (schosen && schosen->time_created < sent->time_created && nperfect == 0) ||
++ (cmatch && nperfect == 1)))
+ {
+- if (firsts != -1)
+- close(firsts);
+- firsts = sockfd;
+- firstn = sent->name;
++ if (schosen)
++ close(schosen->fd);
++ schosen = sent;
+ debug(" taken.\n");
+ }
+ else
+@@ -359,36 +369,27 @@
+ }
+ for (sent = slist; sent; sent = sent->next)
+ {
+- switch (sent->mode)
++ char timestr[64];
++ if (sent->time_created == 0)
+ {
+- case 0700:
+- printf("\t%s\t(Attached)\n", sent->name);
+- break;
+- case 0600:
+- printf("\t%s\t(Detached)\n", sent->name);
+- break;
++ sprintf(timestr, "??" "?");
++ }
++ else
++ {
++ strftime(timestr, 64, "%x %X", localtime(&sent->time_created));
++ }
++ printf("\t%s\t(%s)\t(%s)\n", sent->name, timestr,
++ (sent->mode == 0700) ? "Attached" :
++ (sent->mode == 0600) ? "Detached" :
+ #ifdef MULTIUSER
+- case 0701:
+- printf("\t%s\t(Multi, attached)\n", sent->name);
+- break;
+- case 0601:
+- printf("\t%s\t(Multi, detached)\n", sent->name);
+- break;
++ (sent->mode == 0701) ? "Multi, attached" :
++ (sent->mode == 0601) ? "Multi, detached" :
+ #endif
+- case -1:
+- /* No trigraphs here! */
+- printf("\t%s\t(Dead ?%c?)\n", sent->name, '?');
+- break;
+- case -2:
+- printf("\t%s\t(Removed)\n", sent->name);
+- break;
+- case -3:
+- printf("\t%s\t(Remote or dead)\n", sent->name);
+- break;
+- case -4:
+- printf("\t%s\t(Private)\n", sent->name);
+- break;
+- }
++ (sent->mode == -1) ? "Dead ??" "?" :
++ (sent->mode == -2) ? "Removed" :
++ (sent->mode == -3) ? "Remote or dead" :
++ (sent->mode == -4) ? "Private" :
++ "Unknown");
+ }
+ }
+ if (ndead && !quietflag)
+@@ -399,10 +400,10 @@
+ else
+ Msg(0, m, ndead > 1 ? "s" : "", ndead > 1 ? "" : "es"); /* other args for nethack */
+ }
+- if (firsts != -1)
++ if (schosen)
+ {
+- sprintf(SockPath + sdirlen, "/%s", firstn);
+- *fdp = firsts;
++ sprintf(SockPath + sdirlen, "/%s", schosen->name);
++ *fdp = schosen->fd;
+ }
+ else
+ SockPath[sdirlen] = 0;
diff --git a/debian/patches/85_bracketed-paste-patch-by-Unit193_dpaste.com_5KJ572GZM.patch b/debian/patches/85_bracketed-paste-patch-by-Unit193_dpaste.com_5KJ572GZM.patch
new file mode 100644
index 0000000..2a9491d
--- /dev/null
+++ b/debian/patches/85_bracketed-paste-patch-by-Unit193_dpaste.com_5KJ572GZM.patch
@@ -0,0 +1,281 @@
+Origin: https://savannah.gnu.org/bugs/download.php?file_id=52911
+Author: Hayaki Saito <user@zuse.jp>
+Date: Fri, 15 Mar 2013 16:23:54 +0100
+Description: Support "bracket paste mode" and cursor-style manipulation
+Bug: https://savannah.gnu.org/bugs/?62102
+Bug-Debian: https://bugs.debian.org/1019576
+
+Hello, lists
+
+This patch adds the following two features to GNU Screen:
+
+- Bracket Paste Mode (DECSET/DECRST 2004)
+- DECSCUSR(cursor style manipulation)
+
+By using "bracketed paste mode", the pasted text is bracketed with special
+control sequences.
+DECSCUSR can change cursor style and shape (blink/steady, block/Vertical
+bar/horizontal bar).
+
+ref: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+
+These days, many of xterm-compatible terminal emulators support these features.
+But current GNU Screen blocks them.
+This patch manages states of "Bracket Paste Mode (DECSET/DECRST 2004)" and
+DECSCUSR(cursor style manipulation), for each of screens.
+
+Please check it.
+
+Hayaki Saito <user@zuse.jp>
+
+https://lists.gnu.org/archive/html/screen-devel/2013-03/msg00000.html
+---
+ ansi.c | 12 ++++++++++++
+ display.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ display.h | 4 ++++
+ extern.h | 4 ++++
+ layer.c | 26 ++++++++++++++++++++++++++
+ window.c | 2 ++
+ window.h | 2 ++
+ 7 files changed, 100 insertions(+)
+
+--- a/ansi.c 2022-09-03 21:07:05.736418077 -0400
++++ b/ansi.c 2022-09-03 21:07:05.728418022 -0400
+@@ -194,6 +194,8 @@
+ p->w_origin = 0;
+ p->w_insert = 0;
+ p->w_revvid = 0;
++ p->w_bracketed = 0;
++ p->w_cursorstyle = 0;
+ p->w_mouse = 0;
+ p->w_curinv = 0;
+ p->w_curvvis = 0;
+@@ -1346,6 +1348,12 @@
+ break;
+ }
+ break;
++ case ' ':
++ if (c == 'q') {
++ curr->w_cursorstyle = a1;
++ LCursorStyle(&curr->w_layer, curr->w_cursorstyle);
++ }
++ break;
+ case '?':
+ for (a2 = 0; a2 < curr->w_NumArgs; a2++)
+ {
+@@ -1477,6 +1485,10 @@
+ LExtMouseMode(&curr->w_layer, curr->w_extmouse);
+ break;
+ /* case 1015: UXRVT mouse mode rejected */
++ case 2004: /* bracketed paste mode */
++ curr->w_bracketed = i ? 1 : 0;
++ LBracketedPasteMode(&curr->w_layer, curr->w_bracketed);
++ break;
+ }
+ }
+ break;
+--- a/display.c 2022-09-03 21:07:05.736418077 -0400
++++ b/display.c 2022-09-03 21:07:05.732418049 -0400
+@@ -130,6 +130,8 @@
+ int defobuflimit = OBUF_MAX;
+ int defnonblock = -1;
+ int defmousetrack = 0;
++int defbracketed = 0;
++int defcursorstyle = 0;
+ #ifdef AUTO_NUKE
+ int defautonuke = 0;
+ #endif
+@@ -192,6 +194,8 @@
+ LCursorkeysMode(flayer, 0);
+ LCursorVisibility(flayer, 0);
+ LMouseMode(flayer, 0);
++ LBracketedPasteMode(flayer, 0);
++ LCursorStyle(flayer, 0);
+ LSetRendition(flayer, &mchar_null);
+ LSetFlow(flayer, nwin_default.flowflag & FLOW_NOW);
+ }
+@@ -323,6 +327,8 @@
+ D_user = *u;
+ D_processinput = ProcessInput;
+ D_mousetrack = defmousetrack;
++ D_bracketed = defbracketed;
++ D_cursorstyle = defcursorstyle;
+ return display;
+ }
+
+@@ -497,6 +503,8 @@
+ D_mousetrack = 0;
+ MouseMode(0);
+ ExtMouseMode(0);
++ BracketedPasteMode(0);
++ CursorStyle(0);
+ SetRendition(&mchar_null);
+ SetFlow(FLOW_NOW);
+ #ifdef MAPKEYS
+@@ -871,6 +879,42 @@
+ }
+ }
+
++void BracketedPasteMode(int mode)
++{
++ if (!display)
++ return;
++
++ if (D_bracketed != mode) {
++ if (!D_CXT)
++ return;
++ if (D_bracketed) {
++ AddStr("\033[?2004l");
++ }
++ if (mode) {
++ AddStr("\033[?2004h");
++ }
++ D_bracketed = mode;
++ }
++}
++
++void CursorStyle(int mode)
++{
++ char buf[32];
++
++ if (!display)
++ return;
++
++ if (D_cursorstyle != mode) {
++ if (!D_CXT)
++ return;
++ if (mode < 0)
++ return;
++ sprintf(buf, "\033[%d q", mode);
++ AddStr(buf);
++ D_cursorstyle = mode;
++ }
++}
++
+ static int StrCost;
+
+ /* ARGSUSED */
+@@ -1297,6 +1341,8 @@
+ CursorVisibility(0);
+ MouseMode(0);
+ ExtMouseMode(0);
++ BracketedPasteMode(0);
++ CursorStyle(0);
+ SetRendition(&mchar_null);
+ SetFlow(FLOW_NOW);
+
+@@ -3198,6 +3244,8 @@
+ int oldcurvis = D_curvis;
+ int oldmouse = D_mouse;
+ int oldextmouse = D_extmouse;
++ int oldbracketed = D_bracketed;
++ int oldcursorstyle = D_cursorstyle;
+
+ oldrend = D_rend;
+ len = D_obufp - D_obuf;
+@@ -3261,6 +3309,8 @@
+ CursorVisibility(oldcurvis);
+ MouseMode(oldmouse);
+ ExtMouseMode(oldextmouse);
++ BracketedPasteMode(oldbracketed);
++ CursorStyle(oldcursorstyle);
+ if (D_CWS)
+ {
+ debug("ResizeDisplay: using WS\n");
+--- a/display.h 2022-09-03 21:07:05.736418077 -0400
++++ b/display.h 2022-09-03 21:07:05.732418049 -0400
+@@ -111,6 +111,8 @@
+ struct mouse_parse d_mouse_parse; /* state of mouse code parsing */
+ int d_mousetrack; /* set when user wants to use mouse even when the window
+ does not */
++ int d_bracketed; /* bracketed paste mode */
++ int d_cursorstyle; /* cursor style */
+ #ifdef RXVT_OSC
+ int d_xtermosc[5]; /* osc used */
+ #endif
+@@ -198,6 +200,8 @@
+
+ #define D_user DISPLAY(d_user)
+ #define D_username (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0)
++#define D_bracketed DISPLAY(d_bracketed)
++#define D_cursorstyle DISPLAY(d_cursorstyle)
+ #define D_canvas DISPLAY(d_canvas)
+ #define D_cvlist DISPLAY(d_cvlist)
+ #define D_layout DISPLAY(d_layout)
+--- a/extern.h 2022-09-03 21:07:05.736418077 -0400
++++ b/extern.h 2022-09-03 21:07:05.732418049 -0400
+@@ -291,6 +291,8 @@
+ extern void CursorVisibility __P((int));
+ extern void MouseMode __P((int));
+ extern void ExtMouseMode __P((int));
++extern void BracketedPasteMode (int);
++extern void CursorStyle (int);
+ extern void SetFont __P((int));
+ extern void SetAttr __P((int));
+ extern void SetColor __P((int, int));
+@@ -454,6 +456,8 @@
+ extern void LCursorkeysMode __P((struct layer *, int));
+ extern void LMouseMode __P((struct layer *, int));
+ extern void LExtMouseMode __P((struct layer *, int));
++extern void LBracketedPasteMode __P((struct layer *, int));
++extern void LCursorStyle __P((struct layer *, int));
+ #if defined(USEVARARGS)
+ extern void LMsg __P((int, const char *, ...)) __attribute__((format(printf, 2, 3)));
+ #else
+--- a/layer.c 2022-09-03 21:07:05.736418077 -0400
++++ b/layer.c 2022-09-03 21:07:05.732418049 -0400
+@@ -840,6 +840,32 @@
+ }
+ }
+
++void LBracketedPasteMode(struct layer *l, int on)
++{
++ struct canvas *cv;
++ for (cv = l->l_cvlist; cv; cv = cv->c_lnext) {
++ display = cv->c_display;
++ if (D_blocked)
++ continue;
++ if (cv != D_forecv)
++ continue;
++ BracketedPasteMode(on);
++ }
++}
++
++void LCursorStyle(struct layer *l, int style)
++{
++ struct canvas *cv;
++ for (cv = l->l_cvlist; cv; cv = cv->c_lnext) {
++ display = cv->c_display;
++ if (D_blocked)
++ continue;
++ if (cv != D_forecv)
++ continue;
++ CursorStyle(style);
++ }
++}
++
+ void LClearAll(struct layer *l, int uself)
+ {
+ LClearArea(l, 0, 0, l->l_width - 1, l->l_height - 1, 0, uself);
+--- a/window.c 2022-09-03 21:07:05.736418077 -0400
++++ b/window.c 2022-09-03 21:07:05.732418049 -0400
+@@ -509,6 +509,8 @@
+ CursorVisibility(fore->w_curinv ? -1 : fore->w_curvvis);
+ MouseMode(fore->w_mouse);
+ ExtMouseMode(fore->w_extmouse);
++ BracketedPasteMode(fore->w_bracketed);
++ CursorStyle(fore->w_cursorstyle);
+ }
+ }
+
+--- a/window.h 2022-09-03 21:07:05.736418077 -0400
++++ b/window.h 2022-09-03 21:07:05.732418049 -0400
+@@ -241,6 +241,8 @@
+ #endif
+ int w_mouse; /* mouse mode 0,9,1000 */
+ int w_extmouse; /* extended mouse mode 0,1006 */
++ int w_bracketed; /* bracketed paste mode */
++ int w_cursorstyle; /* cursor style */
+ #ifdef HAVE_BRAILLE
+ int w_bd_x, w_bd_y; /* Braille cursor position */
+ #endif
diff --git a/debian/patches/90_fix_man_page_bash_example.patch b/debian/patches/90_fix_man_page_bash_example.patch
new file mode 100644
index 0000000..1121e57
--- /dev/null
+++ b/debian/patches/90_fix_man_page_bash_example.patch
@@ -0,0 +1,32 @@
+Description: Fix bash example in man page
+ See the matrix at
+ https://web.archive.org/web/20210925033649/https://tanguy.ortolo.eu/blog/article25/shrc
+ for the weird and confusing logic of bash reading its configuration
+ files.
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/screen/+bug/1986839
+Forwarded: no
+Author: Tired Sysadmin <https://launchpad.net/~wearyofallthiscrap>
+Author: Axel Beckert <abe@debian.org>
+
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -3308,7 +3308,7 @@
+ execute the program specified in $SHELL.
+ If the command begins with a '\-' character, the shell will be started as a
+ login-shell. Typical shells do only minimal initialization when not started as a login-shell.
+-E.g. Bash will not read your \*Q~/.bashrc\*U unless it is a login-shell.
++E.g. Bash will not read your \*Q~/.bash_profile\*U unless it is a login-shell.
+ .RE
+ .TP
+ .B "shelltitle \fItitle\fP"
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -1367,7 +1367,7 @@
+ program specified in @code{$SHELL}.
+ If the command begins with a @samp{-} character, the shell will be started as a
+ login-shell. Typical shells do only minimal initialization when not started as a login-shell.
+-E.g. Bash will not read your @file{~/.bashrc} unless it is a login-shell.
++E.g. Bash will not read your @file{~/.bash_profile} unless it is a login-shell.
+
+ @code{defshell} is currently a synonym to the @code{shell} .screenrc command.
+ @end deffn
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..335b704
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,17 @@
+# 01-08: fixes to configure, altering preprocessor macros etc.
+05prefer-libtinfo-over-libcurses.patch
+# 10-79: "regular" code and documentation fixes
+11replace_doc_paths.patch
+13split_info_files.patch
+26source_encoding.patch
+45suppress_remap.patch
+60-screen-4.2.1-debian4.1.0-compatibility.patch
+61-default-PATH_MAX-if-undefined-for-hurd.patch
+63-add-utempter-switch.patch
+65-wcwidth.patch
+# 80-89: experimental patches, new features etc.
+80_session_creation_docs.patch
+81_session_creation_util.patch
+82_session_creation_core.patch
+85_bracketed-paste-patch-by-Unit193_dpaste.com_5KJ572GZM.patch
+90_fix_man_page_bash_example.patch