hi,

here is a patch that enables to clear a key map by assigning an
empty table.  works for me.  (well, one can hack a vi key binding
for the wedln with it :)

overloading the binding function that way is clearly ugly
(not to mention creating key maps every time you switch vi mode).

but as a vi addict and ion code ignorant so far i had no choice ...

ingo

ahm, there is one serious item, though, currently process_bindings()
segfaults on an empty table.



Only in ../ion: exclude-files
diff -ur --exclude-from exclude-files ../ion-snapshot/ion/ioncore/binding.c 
../ion/ioncore/binding.c
--- ../ion-snapshot/ion/ioncore/binding.c       2003-07-11 00:56:27.000000000 +0200
+++ ../ion/ioncore/binding.c    2003-07-31 23:16:52.000000000 +0200
@@ -141,14 +141,21 @@
 
 void deinit_bindmap(WBindmap *bindmap)
 {
-       int i;
-       WBinding *binding;
-       
        while(bindmap->rbind_list!=NULL){
                region_remove_bindmap(bindmap->rbind_list->reg,
                                                          bindmap);
        }
                
+       clear_bindings(bindmap);
+       bindmap->parent=NULL;
+}
+
+
+void clear_bindings(WBindmap *bindmap)
+{
+       int i;
+       WBinding *binding;
+       
        binding=bindmap->bindings;
        
        for(i=0; i<bindmap->nbindings; i++, binding++)
@@ -157,11 +164,9 @@
        free(bindmap->bindings);
        bindmap->bindings=NULL;
        bindmap->nbindings=0;
-       bindmap->parent=NULL;
 }
 
 
-       
 bool add_binding(WBindmap *bindmap, const WBinding *b)
 {
        WBinding *binding;
diff -ur --exclude-from exclude-files ../ion-snapshot/ion/ioncore/binding.h 
../ion/ioncore/binding.h
--- ../ion-snapshot/ion/ioncore/binding.h       2003-05-31 17:04:38.000000000 +0200
+++ ../ion/ioncore/binding.h    2003-07-28 11:02:26.000000000 +0200
@@ -66,6 +66,7 @@
 extern void init_bindings();
 extern WBindmap *create_bindmap();
 extern void deinit_bindmap(WBindmap *bindmap);
+extern void clear_bindings(WBindmap *bindmap);
 extern void deinit_binding(WBinding *binding);
 extern bool add_binding(WBindmap *bindmap, const WBinding *binding);
 extern WBinding *lookup_binding(WBindmap *bindmap, int act,
diff -ur --exclude-from exclude-files ../ion-snapshot/ion/ioncore/conf-bindings.c 
../ion/ioncore/conf-bindings.c
--- ../ion-snapshot/ion/ioncore/conf-bindings.c 2003-07-11 00:56:27.000000000 +0200
+++ ../ion/ioncore/conf-bindings.c      2003-07-31 22:55:12.000000000 +0200
@@ -275,6 +275,10 @@
        int i, n, nok=0;
        ExtlTab ent;
        
+       if (tab==extl_table_none()) {
+               clear_bindings(bindmap);
+               return FALSE;
+       }
        n=extl_table_get_n(tab);
        
        for(i=1; i<=n; i++){
Only in ../ion/ioncore: ioncore
Only in ../ion: patch
Only in ../ion/scripts: ion

Reply via email to