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


> -----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>.


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