jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

RE: Patch for %F in the statusline


Greetings,

Actually, my original patch coped with path+filename lengths of up to 255 characters because I use a small font, a large screen, long paths and increased the size of the buf[] array to 256 characters! ;-)

I like your idea of truncating the path, but 20 characters is too short for me, and anything longer would probably be too long for other people (you can please some of the people all of the time....), so I think I'd have to either ask for, or (if I can find the time) add the '%20D' format, so that I can use '%255D' and everyone else can use '%20D'!

Also, we have potential confusion here, as I used %F for 'full path & filename', but you have used (with equal validity) %D for 'truncated directory'. I suppose we could happily support both, of course!

In the past, I've posted patches directly to John Davis for inclusion in future releases to prevent fragmentation of the JED source tree.

Regards

John Skilleter

-----Original Message-----
From: owner-jed-users-l@xxxxxxxxxxxxxx
[mailto:owner-jed-users-l@xxxxxxxxxxxxxx]On Behalf Of SANGOI DINO
Sent: 05 March 2002 10:30
To: Jed-Users-L (E-mail)
Subject: RE: Patch for %F in the statusline


> -----Original Message-----
> From: Joachim Schmitz [mailto:js@xxxxxxxxxxxxx]
> Sent: lunedì 4 marzo 2002 19.11
> Subject: Patch for %F in the statusline
> 
> Hi,
> 
> here is a patch from John Skilleter, which enables the %F in the
statusline 
> to display the filename of the currentbuffer. I modified it slightly, to 
> also include parts of the path. I find it very usefull.
> 
[SNIP]

Hi, 

   I think there are some problems with this patch. Windows users will be
not too happy with this (which may even segfault when the path is longer
than 20 chars). Maybe this is a problem also on VMS and OS/2.

   Some time ago I wrote a simple patch to add '%d' format to
set_status_line, to put the full path. As you (or John Skilleter) noticed,
this is annoing when the path is too long. So I took some ideas from John's
patch, And wrote this one. The main difference is that this patch doesn't
try to parse long paths, instead it simply takes the last part, and puts
three dots at the beginning. Also these new formats are only for the
directory part, so you should use %d%f or %D%f.
(I'm still not happy with the hard encoded maximum length, but changing this
to allow '%20D' formats seems overkill...). 

--- screen.c.orig	Mon Oct  8 09:30:31 2001
+++ screen.c	Tue Mar  5 09:24:44 2002
@@ -677,6 +677,16 @@
 	     if (CBuf->flags & ABBREV_MODE) str = " abbrev"; else str =
NULL;
 	     break;
 	   case 'f': str = CBuf->file; break;
+	   case 'd': str = CBuf->dir;  break;
+	   case 'D':
+		str = CBuf->dir; 
+		top = strlen(str); /* abusing 'top' to avoid defining a new
variable ... */
+		if (top > 20) 
+		  {
+		     str = strcpy(buf, str + top - 20);
+		     str[0] = str[1] = str[2] = '.';
+		  }
+		break;
 	   case 'n':
 	     narrows = jed_count_narrows ();
 	     if (narrows)
--------
--- window.tm.orig	Tue Mar  5 09:33:21 2002
+++ window.tm	Tue Mar  5 09:47:35 2002
@@ -245,6 +245,8 @@
 #v+
         %b   buffer name
         %f   file name
+        %d   directory
+        %D   directory (only the last 20 characters)
         %v   JED version
         %t   current time --- only used if variable DISPLAY_TIME is
non-zero
         %p   line number or percent string. If LINENUMBERS is 2, this
--------

Later,
						Dino

-- 
Don't worry over what other people are thinking about you. They're too busy
worrying over what you are thinking about them

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]