bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-29 07:32:07 +03:00
parent 3e5c52b676
commit 3833545c55
2 changed files with 27 additions and 9 deletions

View File

@ -821,6 +821,7 @@ module.Keyboard = core.ImageGridFeatures.Feature({
//---------------------------------------------------------------------
// XXX make these usable for any keyboard handler, not just the builtin...
var KeyboardUIActions = actions.Actions({
config: {
// NOTE: this is defined in ui-dialogs feature...
@ -828,6 +829,7 @@ var KeyboardUIActions = actions.Actions({
},
// XXX sub-group by path (???)
// XXX make this usable for other other handlers...
browseKeyboardBindings: ['Help/Keyboard bindings...',
core.doc`Keyboard bindings viewer...
@ -917,7 +919,7 @@ var KeyboardUIActions = actions.Actions({
var dialog = browse.makeLister(null,
function(path, make){
var keys = kb.keys('*')
var keybindings = that.keybindings
var keybindings = kb.keyboard
Object.keys(keybindings)
.forEach(function(mode){
@ -1227,7 +1229,7 @@ var KeyboardUIActions = actions.Actions({
dialog.newKey = function(){
that.editKeyBinding(this.select('!').attr('mode')
|| Object.keys(that.keybindings)[0]) }
|| Object.keys(kb.keyboard)[0]) }
dialog.newMode = function(){
that.editKeyboardMode() }

View File

@ -1167,7 +1167,7 @@ var BrowserPrototype = {
holdSize: 20,
},
// XXX TEST: this should prevent event propagation...
// XXX need a way to access buttons...
// XXX should we have things like ctrl-<number> for fast selection
// in filter mode???
keybindings: {
@ -1561,9 +1561,8 @@ var BrowserPrototype = {
//
// item format:
// - str - item text
// NOTE: if text is '---' then a
// separator item is created, it is
// not selectable (default: <hr>).
// NOTE: see: .options.elementShorthand
// for shorthands for common elements
//
// - [str/func, ... ] - item elements
// Each of the elements is individually
@ -1582,6 +1581,16 @@ var BrowserPrototype = {
// Both traversable and disabled are optional and can take bool
// values.
//
// If item matches .options.itemShortcutMarker (default: /\$(\w)/)
// then the char after the '$' will be used as a keyboard shortcut
// for this item the char wrapped in a span (class: .keyboard-shortcut),
// and the marker (in this case '$') will be cleaned out.
// Also see: item.options.shortcut_key below.
//
// NOTE: only the first occurrence of key will get registered...
// NOTE: shortcuts can't override Browse shortcuts...
//
//
// options format:
// {
// // If true make the element traversable...
@ -1942,10 +1951,13 @@ var BrowserPrototype = {
// text marker...
if(item_shortcut_marker){
var did_register = false
var _replace = function(){
// get the last group...
var key = [].slice.call(arguments).slice(-3)[0]
!item_shortcuts[key]
// NOTE: this is a side-effect...
&& (did_register = true)
&& that.keyboard.handler(
'ItemShortcuts',
key,
@ -1960,9 +1972,13 @@ var BrowserPrototype = {
e = $(e)
e.html(e.html().replace(item_shortcut_marker,
function(){
return '<span class="keyboard-shortcut">'
+_replace.apply(this, arguments)
+'</span>' })) })
did_register = false
var k = _replace.apply(this, arguments)
return !did_register ?
`<span class="keyboard-shortcut">${k}</span>`
: k
}))
})
}
}
//---------------------------------------------------------