1 Subject: strip trailing components from hostname in window title
3 The %h format takes an optional digit argument: %nh
8 source/windowTitle.c | 23 ++++++++++++++++++++++-
9 2 files changed, 24 insertions(+), 2 deletions(-)
11 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
12 --- old/source/windowTitle.c
13 +++ new/source/windowTitle.c
14 @@ -246,7 +246,8 @@ static void compressWindowTitle(char *ti
15 ** of trailing directory components to display. Skipped components are
16 ** replaced by an ellipsis (...).
19 +** %[n]h : host name, with one optional digit specifying the max number
20 + of leading hosts components to dispaly.
24 @@ -349,6 +350,26 @@ char *FormatWindowTitle(const char* file
26 titlePtr = safeStrCpy(titlePtr, titleEnd, trailingPath);
28 + } else if (*titleFormat == 'h') {
29 + int comps = c - '0';
30 + char* hostname = strdup(GetNameOfHost());
32 + hostNamePresent = True;
33 + titleFormat++; /* delete the argument */
36 + if ((n = strchr(n, '.'))) {
39 + while (*n && *n == '.')
46 + titlePtr = safeStrCpy(titlePtr, titleEnd, hostname);
51 diff --quilt old/doc/help.etx new/doc/help.etx
54 @@ -1078,7 +1078,8 @@ Tabs/Emulated Tabs
55 .. components to display. Skipped components are
56 .. replaced by an ellipsis (...).
57 .. %f file name, without the path name
59 +.. %[n]h host name, with one optional digit specifying the max number
60 +.. of leading hosts components to dispaly.
61 .. %s NEdit server name (server mode only)
62 .. %[*]S file status, either verbose (%S) or brief (%*S).
63 .. In verbose mode the file status is spelled out: