still busted

This commit is contained in:
Dana Jansens 2002-12-30 20:49:56 +00:00
parent 509e6a8f43
commit 40f3dfbaad

View file

@ -150,7 +150,6 @@ BindingTree *OBBindings::buildtree(const StringVect &keylist, int id)
ret = new BindingTree(id); ret = new BindingTree(id);
if (!p) ret->chain = false; if (!p) ret->chain = false;
ret->first_child = p; ret->first_child = p;
printf("adding child %lx\n", (long)p);
if (!translate(*it, ret->binding, true)) { if (!translate(*it, ret->binding, true)) {
destroytree(ret); destroytree(ret);
ret = 0; ret = 0;
@ -211,6 +210,7 @@ void OBBindings::assimilate(BindingTree *node)
{ {
BindingTree *a, *b, *tmp, *last; BindingTree *a, *b, *tmp, *last;
printf("node=%lx\n", (long)node);
if (!_keytree.first_child) { if (!_keytree.first_child) {
// there are no nodes at this level yet // there are no nodes at this level yet
_keytree.first_child = node; _keytree.first_child = node;
@ -220,16 +220,21 @@ void OBBindings::assimilate(BindingTree *node)
last = a; last = a;
b = node; b = node;
while (a) { while (a) {
printf("in while.. b=%lx\n", (long)b);
last = a; last = a;
if (a->binding != b->binding) { if (a->binding != b->binding) {
a = a->next_sibling; a = a->next_sibling;
} else { } else {
printf("a: %s %d %d\n", a->text.c_str(), a->binding.key, a->binding.modifiers);
printf("b: %s %d %d\n", b->text.c_str(), b->binding.key, b->binding.modifiers);
printf("moving up one in b\n");
tmp = b; tmp = b;
b = b->first_child; b = b->first_child;
delete tmp; delete tmp;
a = a->first_child; a = a->first_child;
} }
} }
printf("after while.. b=%lx\n", (long)b);
if (last->binding != b->binding) if (last->binding != b->binding)
last->next_sibling = b; last->next_sibling = b;
else else
@ -266,7 +271,7 @@ bool OBBindings::add_key(const StringVect &keylist, int id)
if (!(tree = buildtree(keylist, id))) if (!(tree = buildtree(keylist, id)))
return false; // invalid binding requested return false; // invalid binding requested
if (find_key(tree) < -1) { if (find_key(tree) != -1) {
// conflicts with another binding // conflicts with another binding
destroytree(tree); destroytree(tree);
return false; return false;