diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2003-12-28 16:05:28 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2003-12-28 16:05:28 +0000 |
commit | 8ed48c277afad174675b3d6dcb8e7b00a4bcc97d (patch) | |
tree | 53d9baa35f9420264e2f53ad4db850c400c3e2c6 /src/termcap.c | |
parent | 2e7f2ec031f1708b80df9dc1f60f6b1cb24a5c02 (diff) | |
parent | 69348b2a71cbabeb23e3b7d5dce354c5bc4bd311 (diff) | |
download | emacs-8ed48c277afad174675b3d6dcb8e7b00a4bcc97d.tar.gz emacs-8ed48c277afad174675b3d6dcb8e7b00a4bcc97d.tar.bz2 emacs-8ed48c277afad174675b3d6dcb8e7b00a4bcc97d.zip |
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-1
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-2
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-3
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-17
Diffstat (limited to 'src/termcap.c')
-rw-r--r-- | src/termcap.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/termcap.c b/src/termcap.c index b1e0a87936e..a1c068e0964 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -284,6 +284,52 @@ tgetst1 (ptr, area) } *r++ = c; } + + /* Sometimes entries have "%pN" which means use parameter N in the + next %-substitution. If all such N are continuous in the range + [1,9] we can remove each "%pN" because they are redundant, thus + reducing bandwidth requirements. True, Emacs is well beyond the + days of 150baud teletypes, but some of its users aren't much so. + + This pass could probably be integrated into the one above but + abbreviation expansion makes that effort a little more hairy than + its worth; this is cleaner. */ + { + register int last_p_param = 0; + int remove_p_params = 1; + struct { char *beg; int len; } cut[11]; + + for (cut[0].beg = p = ret; p < r - 3; p++) + { + if (!remove_p_params) + break; + if (*p == '%' && *(p + 1) == 'p') + { + if (*(p + 2) - '0' == 1 + last_p_param) + { + cut[last_p_param].len = p - cut[last_p_param].beg; + last_p_param++; + p += 3; + cut[last_p_param].beg = p; + } + else /* not continuous: bail */ + remove_p_params = 0; + if (last_p_param > 10) /* too many: bail */ + remove_p_params = 0; + } + } + if (remove_p_params && last_p_param) + { + register int i; + char *wp; + + cut[last_p_param].len = r - cut[last_p_param].beg; + for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len) + bcopy (cut[i].beg, wp, cut[i].len); + r = wp; + } + } + *r = '\0'; /* Update *AREA. */ if (area) |