Implement a new knob WITH_SHOWENC to show the encoding of every window

on status line.

PR:		124492
Submitted by:	Yi-Jheng Lin <yzlin@cs.nctu.edu.tw>
This commit is contained in:
Cy Schubert 2008-07-25 04:53:02 +00:00
parent 14f9a7a695
commit 1acf4c833e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=217457
2 changed files with 39 additions and 2 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= screen
PORTVERSION= 4.0.3
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.uni-erlangen.de/pub/utilities/screen/ \
http://komquats.com/distfiles/ \
@ -23,7 +23,8 @@ OPTIONS= CJK "Treat CJK ambiguous characters as full width" OFF \
MAN "Build and install man pages" ON \
NETHACK "Enable nethack-style messages" ON \
XTERM_256 "Enable support for 256 colour xterm" OFF \
HOSTINLOCKED "Print user@host in locked message" OFF
HOSTINLOCKED "Print user@host in locked message" OFF \
SHOWENC "Show encoding on the status line" OFF
NO_PACKAGE= Tends to loop using 100% CPU when used from package - perhaps it hard-codes information about the build host
@ -67,6 +68,11 @@ EXTRA_PATCHES+= ${FILESDIR}/opt-cjkwidth
EXTRA_PATCHES+= ${FILESDIR}/opt-hostinlocked
.endif
# show encoding on the status line via option "showenc"
.if defined(WITH_SHOWENC)
EXTRA_PATCHES+= ${FILESDIR}/opt-showencoding
.endif
post-patch:
@${RM} ${WRKSRC}/doc/screen.info*
@${REINPLACE_CMD} -e 's|/dev/ptmx|/nonexistent|' ${WRKSRC}/configure

View file

@ -0,0 +1,31 @@
--- process.c.orig 2008-05-08 02:37:33.000000000 +0800
+++ process.c 2008-05-08 02:37:49.000000000 +0800
@@ -3422,6 +3422,7 @@
{
WinSwitchEncoding(fore, n);
ResetCharsets(fore);
+ RedisplayDisplays(0);
}
else if (i && display)
D_encoding = n;
--- screen.c.orig 2008-05-08 02:37:22.000000000 +0800
+++ screen.c 2008-05-20 20:34:37.000000000 +0800
@@ -2584,6 +2584,18 @@
}
p += strlen(p) - 1;
break;
+#ifdef ENCODINGS
+ case 'e':
+ *p = 0;
+ D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0;
+ if (win && win->w_encoding)
+ {
+ *p++ = ' ';
+ strcpy(p, EncodingName(win->w_encoding));
+ }
+ p += strlen(p) - 1;
+ break;
+#endif
case '{':
{
char rbuf[128];