[vlc-commits] commit: fix zsh completion ( Rafaël Carré )

git at videolan.org git at videolan.org
Thu Aug 19 02:25:52 CEST 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Thu Aug 19 02:23:35 2010 +0200| [faa09ff63a2bdf68db989a5a9bfe80027c951c0e] | committer: Rafaël Carré 

fix zsh completion

add needed header to fix build
process all config items
process all items of config lists (off by one)
fix display of lists: some option have a space in their name

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=faa09ff63a2bdf68db989a5a9bfe80027c951c0e
---

 extras/analyser/zsh.cpp |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/extras/analyser/zsh.cpp b/extras/analyser/zsh.cpp
index 318822a..609568a 100644
--- a/extras/analyser/zsh.cpp
+++ b/extras/analyser/zsh.cpp
@@ -39,6 +39,7 @@ typedef std::pair<int, std::string> mcpair;
 
 #include <vlc_common.h>
 #include <vlc/vlc.h>
+#include <vlc_modules.h>
 
 /* evil hack */
 #undef __PLUGIN__
@@ -145,7 +146,7 @@ void ParseModules( mumap &mods, mcmap &mods2 )
             if( p_item->i_type & CONFIG_ITEM )
                 ParseOption( p_item, mods, mods2 );
         }
-        while( i_items++ < p_module->i_config_items && p_item++ );
+        while( ++i_items < p_module->confsize && p_item++ );
 
     }
     module_list_free( p_list );
@@ -268,7 +269,7 @@ void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 )
             int i = p_item->i_list -1;
             char *psz_list;
             if( p_item->ppsz_list_text )
-                asprintf( &psz_list, "%s\\:%s", p_item->ppsz_list[i],
+                asprintf( &psz_list, "%s\\:\\\"%s\\\"", p_item->ppsz_list[i],
                           p_item->ppsz_list_text[i] );
             else
                 psz_list = strdup(p_item->ppsz_list[i]);
@@ -276,10 +277,10 @@ void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 )
             while( i>1 )
             {
                 if( p_item->ppsz_list_text )
-                    asprintf( &psz_list2, "%s\\:%s %s", p_item->ppsz_list[i-1],
+                    asprintf( &psz_list2, "%s\\:\\\"%s\\\" %s", p_item->ppsz_list[i-1],
                               p_item->ppsz_list_text[i-1], psz_list );
                 else
-                    asprintf( &psz_list2, "%s %s", p_item->ppsz_list[i-1],
+                    asprintf( &psz_list2, "\\\"%s\\\" %s", p_item->ppsz_list[i-1],
                               psz_list );
 
                 free( psz_list );
@@ -308,18 +309,18 @@ void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 )
             int i = p_item->i_list -1;
             char *psz_list;
             if( p_item->ppsz_list_text )
-                asprintf( &psz_list, "%d\\:%s", p_item->pi_list[i],
+                asprintf( &psz_list, "%d\\:\\\"%s\\\"", p_item->pi_list[i],
                           p_item->ppsz_list_text[i] );
             else
                 psz_list = strdup(p_item->ppsz_list[i]);
             char *psz_list2;
-            while( i>1 )
+            while( i > 0 )
             {
                 if( p_item->ppsz_list_text )
-                    asprintf( &psz_list2, "%d\\:%s %s", p_item->pi_list[i-1],
+                    asprintf( &psz_list2, "%d\\:\\\"%s\\\" %s", p_item->pi_list[i-1],
                               p_item->ppsz_list_text[i-1], psz_list );
                 else
-                    asprintf( &psz_list2, "%s %s", p_item->ppsz_list[i-1],
+                    asprintf( &psz_list2, "\\\"%s\\\" %s", p_item->ppsz_list[i-1],
                               psz_list );
 
                 free( psz_list );



More information about the vlc-commits mailing list