[Bf-committers] tabcompletion

Joilnen Batista Leite bf-committers@blender.org
Thu, 15 Apr 2004 06:51:36 -0700 (PDT)


--0-1051121953-1082037096=:37588
Content-Type: text/plain; charset=us-ascii
Content-Id: 
Content-Disposition: inline

well i think that it is a little improve :) !

thanks to consider 

Joilnen

pub 1024D/5139533E Joilnen Batista Leite 
F565 BD0B 1A39 390D 827E 03E5 0CD4 0F20 5139 533E





	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
--0-1051121953-1082037096=:37588
Content-Type: text/plain; name="tabpatch.2"
Content-Description: tabpatch.2
Content-Disposition: inline; filename="tabpatch.2"

--- tuhopuu2/source/blender/include/BSE_filesel.h	2003-08-10 17:21:05.000000000 -0300
+++ tuhopuu2_bkp/source/blender/include/BSE_filesel.h	2004-04-12 12:53:58.000000000 -0300
@@ -59,5 +59,6 @@
 void main_to_filelist(struct SpaceFile *sfile);   
 
 void clever_numbuts_filesel(void);
+int find_filename();
 #endif
 
--- tuhopuu2/source/blender/src/filesel.c	2004-03-06 14:07:43.000000000 -0300
+++ tuhopuu2_bkp/source/blender/src/filesel.c	2004-04-12 13:30:07.000000000 -0300
@@ -1,5 +1,5 @@
 /**
- * $Id: filesel.c,v 1.8 2004/03/06 17:07:43 hos Exp $
+ * $Id: filesel.c,v 1.7 2004/02/15 05:53:36 hos Exp $
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
@@ -130,7 +130,7 @@
 static void filesel_select_objects(struct SpaceFile *sfile);
 static void active_file_object(struct SpaceFile *sfile);
 static int groupname_to_code(char *group);
-
+static short my_strspn(char *d, char *s);
 /* local globals */
 
 static rcti scrollrct, textrct, bar;
@@ -2587,3 +2587,52 @@
 	}
 }
 
+int find_filename(){
+	SpaceFile *sfile;
+	short a, flag=0, c=0, tmp=0, tmp_ini=0;
+	struct direntry *file;
+
+	sfile = curarea->spacedata.first;
+	if( !sfile->filelist )
+		return 0;
+	file = sfile->filelist;
+	for(a=0; a<sfile->totfile; a++, file++) {
+		if( !S_ISDIR(file->type) && (strstr(file->relname, sfile->file) == file->relname) || (flag == 1)){
+			if(!flag){
+				tmp = strlen(sfile->file);
+				tmp_ini = tmp;
+				strcpy(sfile->file, file->relname);
+				flag = 1;
+				continue;
+			}
+
+			/* return identic n of chars */
+			c = my_strspn(sfile->file, file->relname);
+			if(c && (c>=tmp || c>=tmp_ini)){
+
+				/* take last pattern */
+				strncpy(sfile->file, file->relname, c);
+				*(sfile->file+c) = '\0';
+				tmp = c;
+			}else if(flag == 1) break;	
+		}
+            
+		if(tmp){
+
+			/* keep right pattern */
+			strncpy(sfile->file, file->relname, tmp);
+			*(sfile->file+tmp) = '\0';
+		}
+	}
+	return 1;
+}
+
+static short my_strspn(char *d, char *s){
+	short count = 0;
+	while(*d && *s && *d==*s){
+		d++;
+		s++;
+		count++;
+	}
+	return count;
+}
--- tuhopuu2/source/blender/src/interface.c	2004-04-03 18:44:35.000000000 -0300
+++ tuhopuu2_bkp/source/blender/src/interface.c	2004-04-12 12:53:58.000000000 -0300
@@ -1253,6 +1253,12 @@
 					}
 				} 
 				break;
+			case TABKEY:
+				if(find_filename()) {
+					but->pos= strlen(str);
+					len= strlen(str);
+					dodraw= 1;
+				}
 			}
 		}
 

--0-1051121953-1082037096=:37588--