Skip to content

Instantly share code, notes, and snippets.

@f440
Forked from yoshikaw/Screenx.rb
Created February 21, 2012 15:53
Show Gist options
  • Save f440/1877122 to your computer and use it in GitHub Desktop.
Save f440/1877122 to your computer and use it in GitHub Desktop.
開発版GNU Screenにあてているパッチ
Patch: expand-input-maxlen.patch
Probrem: More than 100 characters cannot be set to the caption
Solution: expands the text buffer size to 255.
Author: Kazuhiro Yoshikawa <[email protected]>
Files: src/input.c
src/process.c
--- a/src/input.c 2010-02-27 02:30:55.000000000 +0900
+++ b/src/input.c 2010-06-21 00:19:43.000000000 +0900
@@ -43,7 +43,7 @@
struct inpline
{
- char buf[101]; /* text buffer */
+ char buf[256]; /* text buffer */
int len; /* length of the editible string */
int pos; /* cursor position in editable string */
struct inpline *next, *prev;
@@ -58,7 +58,7 @@
struct inpdata
{
struct inpline inp;
- int inpmaxlen; /* 100, or less, if caller has shorter buffer */
+ int inpmaxlen; /* 255, or less, if caller has shorter buffer */
char *inpstring; /* the prompt */
int inpstringlen; /* length of the prompt */
int inpmode; /* INP_NOECHO, INP_RAW, INP_EVERY */
@@ -134,8 +134,8 @@
if (!flayer)
return;
- if (len > 100)
- len = 100;
+ if (len > 255)
+ len = 255;
if (!(mode & INP_NOECHO))
{
maxlen = flayer->l_width - 1 - strlen(istr);
--- a/src/process.c 2010-04-04 02:26:19.000000000 +0900
+++ b/src/process.c 2011-05-04 02:59:00.000000000 +0900
@@ -1796,7 +1796,7 @@
s = *args;
if (!args[0])
{
- Input("Stuff:", 100, INP_COOKED, StuffFin, NULL, 0);
+ Input("Stuff:", 255, INP_COOKED, StuffFin, NULL, 0);
break;
}
n = *argl;
@@ -2083,7 +2083,7 @@
ChangeAKA(fore, *args, strlen(*args));
break;
case RC_COLON:
- Input(":", 100, INP_EVERY, Colonfin, NULL, 0);
+ Input(":", 255, INP_EVERY, Colonfin, NULL, 0);
if (*args && **args)
{
s = *args;
Patch: osx-comment-combined-char.patch
Probrem: display corruption at some combining characters.
Solution: comment out some combined char from mapping table
- 0x3099 voiced sound mark
- 0x309A semi-boiced sound mark
Author: Kazuhiro Yoshikawa <[email protected]>
Files: src/encoding.c
--- a/src/encoding.c 2009-09-26 00:50:28.000000000 +0900
+++ b/src/encoding.c 2010-05-03 00:26:03.000000000 +0900
@@ -998,7 +998,7 @@
{ 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF },
{ 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 },
{ 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F },
- { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
+ /*{ 0x3099, 0x309A }, */{ 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
{ 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F },
{ 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB },
{ 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F },
Patch: screen-devel-string-escape.patch
Probrem: current time is shown by set date and time 'HH:MM'.
but ':' is not suitable for the file path in some environment.
(espacially using it in :logfile)
Solution: create a new definition in the hour and the time.
Author: Kazuhiro Yoshikawa <[email protected]>
Files: src/doc/screen.1
src/screen.c
Refs: This patch is referring to screen-devel mailing-list.
and add some fix.
- adjust source lines
------------
Date: Tue, 8 Jun 2010 19:03:54 -0700
From: Israel Jacques <[email protected]>
To: [email protected]
Subject: [screen-devel] Screen patch for string escape, n and new escapes
Hello everyone.
I would like to submit this very simple patch that allows the n escape
to be qualified with a '0'. In other words, the same behavior as both
the 'c' and 'C' escape.
The patch also includes new escapes: j, k, and K.
j, displays the minutes;
k, displays the hour in 24h format; and
K displays the hour in 12h format.
I have also updated the man page.
While the j, k, and K options seem redundant as both the c and C
escapes display both minutes and hours, I would like to have the
flexibility to be able to give each escape a color attribute.
Israel
------------
diff --git src/doc/screen.1 src/doc/screen.1
index c175891..0eb17d3 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -3700,6 +3700,12 @@ sets %? to true if the window has the focus
hardstatus of the window
.IP H
hostname of the system
+.IP j
+minute
+.IP k
+hour in 24h format
+.IP K
+hour in 12h format
.IP l
current load of the system
.IP m
@@ -3758,7 +3764,7 @@ attribute/color modifier string terminated by the next \*Q}\*U
Substitute with the output of a 'backtick' command. The length
qualifier is misused to identify one of the commands.
.P
-The 'c' and 'C' escape may be qualified with a '0' to make
+The 'n', 'c', and 'C' escape may be qualified with a '0' to make
.I screen
use zero instead of space as fill character. The '0' qualifier
also makes the '=' escape use absolute positions. The 'n' and '='
diff --git src/screen.c src/screen.c
index 3dde3b4..a6696c4 100644
--- a/src/screen.c
+++ b/src/screen.c 2011-05-04 03:42:00.000000000 +0900
@@ -2610,7 +2610,8 @@ int rec;
}
break;
case 'd': case 'D': case 'm': case 'M': case 'y': case 'Y':
- case 'a': case 'A': case 's': case 'c': case 'C':
+ case 'a': case 'A': case 's': case 'c': case 'C': case 'k':
+ case 'K': case 'j':
if (l < 4)
break;
if (tm == 0)
@@ -2669,6 +2670,21 @@ int rec;
if (!tick || tick > 60)
tick = 60;
break;
+ case 'k':
+ sprintf(p, zeroflg ? "%02d" : "%2d", tm->tm_hour);
+ if (!tick || tick > 60)
+ tick = 60;
+ break;
+ case 'K':
+ sprintf(p, zeroflg ? "%02d" : "%2d", (tm->tm_hour + 11) % 12 + 1);
+ if (!tick || tick > 60)
+ tick = 60;
+ break;
+ case 'j':
+ sprintf(p, zeroflg ? "%02d" : "%2d", tm->tm_min);
+ if (!tick || tick > 60)
+ tick = 60;
+ break;
default:
break;
}
@@ -2998,9 +3014,9 @@ int rec;
if (num == 0)
num = 1;
if (!win)
- sprintf(p, "%*s", num, num > 1 ? "--" : "-");
+ sprintf(p, "%*s", num, ((num > 1) || zeroflg) ? "--" : "-");
else
- sprintf(p, "%*d", num, win->w_number);
+ sprintf(p, zeroflg ? "%02d" : "%*d", zeroflg ? win->w_number : num, win->w_number);
qmflag = 1;
p += strlen(p) - 1;
}
Patch: screen-statusline-showencoding.patch
Probrem: by default, :info command shows each window encoding.
but it is inconvenient in a multi encoding environment
to confirm everytime.
Solution: enable to display encoding information at caption/hardstatus.
Author: Kazuhiro Yoshikawa <[email protected]>
Files: src/screen.c
src/process.c
Refs: This patch is referring to screen-devel mailing-list.
and add some fix.
* adjust directory depth
* adjust source lines
------------
Date: Wed, 28 May 2008 15:34:15 +0800
From: Yi-Jheng Lin <[email protected]>
To: [email protected]
Subject: [screen-devel] Statusline showencoding patch
Dear,
I'm so glad that screen supports the encoding transformation. That's =
really a great function for me to switch between Big5 & UTF-8 environment=
! But sometimes I may be confused "What encoding am I using?". Although, =
I can use "Ctrl-a i" to get the information of current window (including =
the encoding info). I was wondering if the statusline could show the enc=
oding of current window, so I patch it!
With this patch, I could add a new parameter "%e" to statusline for s=
howing the encoding of current window. This might not be a good solution,=
but it does work!
The following is the patch.
------------
--- a/src/screen.c 2008-05-08 02:37:22.000000000 +0800
+++ b/src/screen.c 2010-04-04 02:29:00.000000000 +0900
@@ -2778,6 +2778,17 @@
}
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)
+ {
+ strcpy(p, EncodingName(win->w_encoding));
+ }
+ p += strlen(p) - 1;
+ break;
+#endif
case '{':
{
char rbuf[128];
--- a/src/process.c 2008-05-08 02:37:33.000000000 +0800
+++ b/src/process.c 2011-05-04 00:41:00.000000000 +0900
@@ -3673,6 +3673,7 @@
{
WinSwitchEncoding(fore, n);
ResetCharsets(fore);
+ RedisplayDisplays(0);
}
else if (i && display)
D_encoding = n;
require 'formula'
class Screen < Formula
homepage 'http://www.gnu.org/software/screen/'
url 'http://git.savannah.gnu.org/cgit/screen.git/snapshot/screen-df0777e915608ba2d403bb0b3a967b4619e0378b.tar.gz'
sha1 '571dd1e1988fd16936e3021f2f3e83d38b91e63b'
version '4.1.0-20120127git642588a'
head 'git://git.savannah.gnu.org/screen.git', :branch => 'master'
def patches
[
'https://gist.github.com/raw/1519337/24b9b43d9e11557759babeaf098acf8988448666/screen-statusline-showencoding.patch',
'https://gist.github.com/raw/1519337/04dd8fdc435fdeb70cbda0b9d75a2b01b6287278/expand-input-maxlen.patch',
'https://gist.github.com/raw/1519337/d1e708560606ac6778dabac6f8d7d06beff6dfde/screen-devel-string-escape.patch',
'https://gist.github.com/raw/1519337/8180c8eedbd83dcca1e66d7a7b7550916ae835e3/osx-comment-combined-char.patch'
]
end
def install
Dir.chdir 'src' do
system './autogen.sh'
system './configure', "--prefix=#{prefix}",
'--enable-pam',
'--enable-colors256',
'--enable-rxvt_osc',
'--enable-use-locale',
'--enable-telnet'
system 'touch osdef.h'
system 'make install'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment