From 42298eee7b116d0584777dfa0f338efe792690f7 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 7 Apr 2016 04:58:22 +0300 Subject: [PATCH] minor tweaks + added keyboard help (need to rethink)... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/keyboard.js | 27 +++++++++++++++++++++++++++ ui (gen4)/lib/keyboard.js | 11 +++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 5fd7d105..f088f9b9 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -15,6 +15,11 @@ var keyboard = require('lib/keyboard') var core = require('features/core') +var widget = require('lib/widget/widget') +var browse = require('lib/widget/browse') +var overlay = require('lib/widget/overlay') +var drawer = require('lib/widget/drawer') + /*********************************************************************/ @@ -81,6 +86,10 @@ module.GLOBAL_KEYBOARD = { 'on this page.', pattern: '*', + X: { + alt: 'close', + }, + F4: { alt: 'close', }, @@ -348,6 +357,24 @@ var KeyboardActions = actions.Actions({ }, ['on', 'off'])], + // XXX need to pre-process the docs... + // - remove the path component... + // - insert the action name where not doc present... + // XXX cleanup CSS + showKeyboardBindings: ['Interface/Show keyboard bindings', + function(){ + var widget = drawer.Drawer($('body'), + $('
') + .css({ + background: 'white', + }) + .append( + keyboard.buildKeybindingsHelpHTML(this.__keyboard_config, this)), + { + focusable: true, + }) + }], + }) var Keyboard = diff --git a/ui (gen4)/lib/keyboard.js b/ui (gen4)/lib/keyboard.js index 603c40f6..7b67ae51 100755 --- a/ui (gen4)/lib/keyboard.js +++ b/ui (gen4)/lib/keyboard.js @@ -792,6 +792,13 @@ function buildKeybindingsHelp(keybindings, shifted_keys, actions){ var handler = getKeyHandlers(key, mod, keybindings, 'all', null, actions)[pattern] + // no handler... + // NOTE: handler is present in config but not present + // in actions... + if(handler == null){ + continue + } + if(handler.constructor === Array && handler[1] == 'IGNORE NEXT'){ handler = handler[0] } @@ -902,8 +909,8 @@ function getKeysByDoc(doc, help){ // var buildKeybindingsHelpHTML = module.buildKeybindingsHelpHTML = -function buildKeybindingsHelpHTML(keybindings){ - var doc = buildKeybindingsHelp(keybindings) +function buildKeybindingsHelpHTML(keybindings, actions){ + var doc = buildKeybindingsHelp(keybindings, null, actions) var res = '' for(var mode in doc){