+ KeySymbol code = seq->sequence[r];
+ if (!code.isOK())
+ return;
+
+ KeyModifier const mod1 = seq->modifiers[r].first;
+ KeyModifier const mod2 = seq->modifiers[r].second;
+
+ // check if key is already there
+ Table::iterator end = table.end();
+ Table::iterator remove = end;
+ for (Table::iterator it = table.begin(); it != end; ++it) {
+ if (code == it->code
+ && mod1 == it->mod.first
+ && mod2 == it->mod.second) {
+ // remove
+ if (r + 1 == seq->length()) {
+ if (it->func == func) {
+ remove = it;
+ if (it->table.get())
+ it->table.reset();
+ }
+ } else if (it->table.get()) {
+ it->table->unbind(seq, func, r + 1);
+ if (it->table->empty())
+ remove = it;
+ return;
+ }
+ }
+ }
+ if (remove != end)
+ table.erase(remove);
+}
+
+
+docstring KeyMap::printBindings(FuncRequest const & func) const
+{
+ Bindings bindings = findBindings(func);