From 8d19b87cb12b47a5fbf61d28753dd8b72e4bf41b Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 1 Jan 2009 19:54:35 +0000 Subject: [PATCH] Bug 885: Truncate title at 600 bytes, not 1024. Although xterm allows 1024 bytes, GNU Screen apparently has a lower limit. --- src/osdep/osdep.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index e26463e3d..e45716d91 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -447,9 +447,16 @@ set_window_title(unsigned char *title, int codepage) || (unicode >= 0x7F && unicode < 0xA0)) continue; - /* xterm entirely rejects 1024-byte or longer - * titles. */ - if (filtered.length + charlen >= 1024 - 3) { + /* If the title is getting too long, truncate + * it and add an ellipsis. + * + * xterm entirely rejects 1024-byte or longer + * titles. GNU Screen 4.00.03 misparses + * titles longer than 765 bytes, and is unable + * to display the title in hardstatus if the + * title and other stuff together exceed 766 + * bytes. So set the limit quite a bit lower. */ + if (filtered.length + charlen >= 600 - 3) { add_to_string(&filtered, "..."); break; }