From d7fc6b4043cc4b81a2e90403e23fea0d6641857c Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Fri, 1 Jul 2016 09:12:30 +0200 Subject: [PATCH] Show usage of Hints mode modifiers in the help dialog --- documentation/commands.md | 8 ++++-- documentation/options.md | 10 +++++++ extension/lib/defaults.coffee | 1 + extension/lib/help.coffee | 38 ++++++++++++++++++++++++- extension/locale/de/vimfx.properties | 4 +++ extension/locale/en-US/vimfx.properties | 4 +++ extension/locale/es/vimfx.properties | 4 +++ extension/locale/fr/vimfx.properties | 4 +++ extension/locale/id/vimfx.properties | 4 +++ extension/locale/it/vimfx.properties | 4 +++ extension/locale/ja/vimfx.properties | 4 +++ extension/locale/nl/vimfx.properties | 4 +++ extension/locale/pt-BR/vimfx.properties | 4 +++ extension/locale/ru/vimfx.properties | 4 +++ extension/locale/sv-SE/vimfx.properties | 4 +++ extension/locale/zh-CN/vimfx.properties | 4 +++ extension/locale/zh-TW/vimfx.properties | 4 +++ extension/skin/style.css | 7 +++-- 18 files changed, 110 insertions(+), 6 deletions(-) diff --git a/documentation/commands.md b/documentation/commands.md index ae94828..c17b72a 100644 --- a/documentation/commands.md +++ b/documentation/commands.md @@ -225,9 +225,10 @@ the shorter the hint. To learn more about hint characters and hint length, read about the [hint chars] option. Hints are added on top of the corresponding element. If they obscure the display -too much you can hold shift to make them transparent. (See [Styling] if you’d -like to change that.) The hints can also sometimes cover each other. Press -`` and `` to switch which one should be on top. +too much you can hold shift to make them transparent, letting you peek through +them. (See [Styling] and the [hints\_peek\_through] pref if you’d like to change +that.) The hints can also sometimes cover each other. Press `` and +`` to switch which one should be on top. When giving a count to an `f` command, all markers will be re-shown after you’ve typed the hint characters of one of them, _count_ minus one times. All but the @@ -277,6 +278,7 @@ the previous hints.) [hint-matcher]: api.md#vimfxhintmatcher [hint chars]: options.md#hint-chars [Styling]: styling.md +[hints\_peek\_through]: options.md#hints_peek_through [hints\_toggle\_in\_tab]: options.md#hints_toggle_in_tab [hints\_toggle\_in\_background]: options.md#hints_toggle_in_background diff --git a/documentation/options.md b/documentation/options.md index 4a0013b..6daa70c 100644 --- a/documentation/options.md +++ b/documentation/options.md @@ -427,6 +427,16 @@ should be matched against. [“Previous”/“Next” link patterns]: #previousnext-link-patterns +### `hints_peek_through` + +This pref doesn’t do much. If you’ve used custom [styling] to change which +modifier lets you peek through markers in [Hints mode], you might want to change +this pref as well. Otherwise VimFx’s Keyboard Shortcuts dialog will still tell +you to press shift for this task. + +[styling]: styling.md +[Hints mode]: commands.md#the-f-commands--hints-mode + ### `hints_toggle_in_tab` If the keypress that matched a hint starts with this string, toggle whether to diff --git a/extension/lib/defaults.coffee b/extension/lib/defaults.coffee index add8da9..e49c9ff 100644 --- a/extension/lib/defaults.coffee +++ b/extension/lib/defaults.coffee @@ -183,6 +183,7 @@ advanced_options = a, button, input[type="button"] ):not([role="menu"]):not([role="tab"])' 'pattern_attrs': 'rel role data-tooltip aria-label' + 'hints_peek_through': '' 'hints_toggle_in_tab': '' diff --git a/extension/lib/help.coffee b/extension/lib/help.coffee index e36b5ed..3900644 100644 --- a/extension/lib/help.coffee +++ b/extension/lib/help.coffee @@ -97,6 +97,7 @@ createHeader = (window, vimfx) -> createContent = (window, vimfx) -> $ = utils.createBox.bind(null, window.document) + extraCommands = getExtraCommands(vimfx) content = $('content') @@ -120,7 +121,7 @@ createContent = (window, vimfx) -> $('heading-category search-item', categoryContainer, category.name) for {command, name, enabledSequences} in category.commands - commandContainer = $('command search-item', categoryContainer) + commandContainer = $('command has-click search-item', categoryContainer) commandContainer.setAttribute('data-command', name) commandContainer.onclick = goToCommandSetting.bind( null, window, vimfx, command @@ -133,8 +134,43 @@ createContent = (window, vimfx) -> $('key-sequence-rest search-text', keySequence, rest) $('description search-text', commandContainer, command.description) + categoryExtraCommands = extraCommands[mode._name]?[category._name] + if categoryExtraCommands + for name, sequences of categoryExtraCommands + commandContainer = $('command search-item', categoryContainer) + commandContainer.setAttribute('data-command', name) + for sequence in sequences + keySequence = $('key-sequence', commandContainer) + $('key-sequence-rest search-text', keySequence, sequence) + description = translate("mode.#{mode._name}.#{name}") + $('description search-text', commandContainer, description) + return content +getExtraCommands = (vimfx) -> + lastHintChar = translate('help.last_hint_char') + return { + 'hints': { + '': { + 'peek_through': + if vimfx.options.hints_peek_through + [vimfx.options.hints_peek_through] + else + [] + 'toggle_in_tab': + if vimfx.options.hints_toggle_in_tab + ["#{vimfx.options.hints_toggle_in_tab}#{lastHintChar}>"] + else + [] + 'toggle_in_background': + if vimfx.options.hints_toggle_in_background + ["#{vimfx.options.hints_toggle_in_background}#{lastHintChar}>"] + else + [] + } + } + } + splitSequence = (sequence, specialKeys) -> specialKeyEnds = specialKeys.map((key) -> pos = sequence.lastIndexOf(key) diff --git a/extension/locale/de/vimfx.properties b/extension/locale/de/vimfx.properties index 493fda5..a0016d3 100644 --- a/extension/locale/de/vimfx.properties +++ b/extension/locale/de/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx ist im %S. Klicke, um zum %S zurückzukehren. help.title=Tastaturkürzel help.search=Suche +help.last_hint_char=last_hint_char mode.normal=Normalmodus @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Überlappende Markierungen rückwärts drehen mode.hints.delete_hint_char=Lösche zuletzt eingegebenes Hinweiszeichen mode.hints.increase_count=Anzahl erhöhen mode.hints.toggle_complementary=Alle anderen Elemente markieren +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Ignoriermodus mode.ignore.exit=Zum Normalmodus zurückkehren diff --git a/extension/locale/en-US/vimfx.properties b/extension/locale/en-US/vimfx.properties index 8359710..9ded127 100644 --- a/extension/locale/en-US/vimfx.properties +++ b/extension/locale/en-US/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx is in %S. Click to return to %S. help.title=Keyboard Shortcuts help.search=Search +help.last_hint_char=last_hint_char mode.normal=Normal mode @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Rotate overlapping markers backward mode.hints.delete_hint_char=Delete last typed hint character mode.hints.increase_count=Increase count mode.hints.toggle_complementary=Mark all other elements +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Ignore mode mode.ignore.exit=Return to Normal mode diff --git a/extension/locale/es/vimfx.properties b/extension/locale/es/vimfx.properties index b765ebf..0b2ed68 100644 --- a/extension/locale/es/vimfx.properties +++ b/extension/locale/es/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx está en %S. Haga clic para volver a %S. help.title=Atajos de teclado help.search=Buscar +help.last_hint_char=last_hint_char mode.normal=Modo normal @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Rotar indicaciones superpuestas hacia atrás mode.hints.delete_hint_char=Borrar último caracter de indicación tecleado mode.hints.increase_count=Incrementar contador mode.hints.toggle_complementary=Marcar todos los demás elementos +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Modo Ignorar mode.ignore.exit=Volver a modo Normal diff --git a/extension/locale/fr/vimfx.properties b/extension/locale/fr/vimfx.properties index 38ead53..17ec589 100644 --- a/extension/locale/fr/vimfx.properties +++ b/extension/locale/fr/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx est en %S. Cliquez ici pour retourner en %S. help.title=Raccourcis au clavier help.search=Recherche +help.last_hint_char=last_hint_char mode.normal=Mode normal @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Faire tourner en arrière mode.hints.delete_hint_char=Supprimer le dernier caractère frappé lors de la sélection d'un marqueur mode.hints.increase_count= mode.hints.toggle_complementary=Marquer tous les autres éléments +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Mode ignorer mode.ignore.exit=Retourner au mode par défaut diff --git a/extension/locale/id/vimfx.properties b/extension/locale/id/vimfx.properties index ddf5832..2dbead2 100644 --- a/extension/locale/id/vimfx.properties +++ b/extension/locale/id/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx sedang pada %S. Klik untuk kembali ke %S. help.title=Shortcut Keyboard help.search=Cari +help.last_hint_char=last_hint_char mode.normal=Mode normal @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Putar mundur penanda bertumpukan mode.hints.delete_hint_char=Hapus karakter petunjuk terakhir diketik mode.hints.increase_count=Naikkan hitungan mode.hints.toggle_complementary=Tandai semua elemen lain +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Mode Abai mode.ignore.exit=Kembali ke mode Normal diff --git a/extension/locale/it/vimfx.properties b/extension/locale/it/vimfx.properties index 1772cca..d52145f 100644 --- a/extension/locale/it/vimfx.properties +++ b/extension/locale/it/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx si trova in %S. Clicca per ritornare a %S. help.title=Scorciatoie da tastiera help.search=Trova +help.last_hint_char=last_hint_char mode.normal=Modalità normale @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Ruota i marcatori sovrappossti all'indietro mode.hints.delete_hint_char=Cancella l'ultimo carattere di suggerimento digitato mode.hints.increase_count=Aumenta il conteggio mode.hints.toggle_complementary=Marca tutti gli altri elementi +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Modalità Ignore mode.ignore.exit=Ritorna alla modalità normale diff --git a/extension/locale/ja/vimfx.properties b/extension/locale/ja/vimfx.properties index c94ff0b..6bb7a7b 100644 --- a/extension/locale/ja/vimfx.properties +++ b/extension/locale/ja/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFxは現在%Sです。 クリックすると%Sに help.title=キーボードショートカット help.search=検索 +help.last_hint_char=last_hint_char mode.normal=ノーマルモード @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=重なったマーカーを後へ入れ替え mode.hints.delete_hint_char=最後に入力したヒント文字を削除 mode.hints.increase_count=カウントを増やす mode.hints.toggle_complementary=他の全ての要素を選択 +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=無効モード mode.ignore.exit=ノーマルモードへ戻る diff --git a/extension/locale/nl/vimfx.properties b/extension/locale/nl/vimfx.properties index 6e893e5..d21730c 100644 --- a/extension/locale/nl/vimfx.properties +++ b/extension/locale/nl/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx is in %S. Klik om terug te gaan naar %S. help.title=Sneltoetsen help.search=Zoeken +help.last_hint_char=last_hint_char mode.normal=Normale modus @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Ga achteruit in markervolgorde mode.hints.delete_hint_char=Verwijder het laatst getypte markerkarakter mode.hints.increase_count=Verhoog aantal mode.hints.toggle_complementary=Selecteer alle andere elementen +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Negeermodus mode.ignore.exit=Ga terug naar normale modus diff --git a/extension/locale/pt-BR/vimfx.properties b/extension/locale/pt-BR/vimfx.properties index 6c36c0f..593d259 100644 --- a/extension/locale/pt-BR/vimfx.properties +++ b/extension/locale/pt-BR/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx está %S. Clique para %S. help.title=Atalhos de Teclado help.search=Buscar +help.last_hint_char=last_hint_char mode.normal=Modo Normal @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Rotacionar marcadores sobrepostos para trás mode.hints.delete_hint_char=Deletar o último caractere digitado da sugestão mode.hints.increase_count=Incrementar contador mode.hints.toggle_complementary=Marcar todos os outros elementos +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Modo Ignorar mode.ignore.exit=Voltar ao modo Normal diff --git a/extension/locale/ru/vimfx.properties b/extension/locale/ru/vimfx.properties index 56371aa..aeb663a 100644 --- a/extension/locale/ru/vimfx.properties +++ b/extension/locale/ru/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=Активен %S. Щёлкните, чтобы вер help.title=Команды help.search=Поиск +help.last_hint_char=last_hint_char mode.normal=Нормальный режим @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Переставить перекрывающ mode.hints.delete_hint_char=Удалить последний введённый символ mode.hints.increase_count=Увеличить количество mode.hints.toggle_complementary=Маркировать все прочие элементы +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=Режим игнорирования mode.ignore.exit=Вернуться в нормальный режим diff --git a/extension/locale/sv-SE/vimfx.properties b/extension/locale/sv-SE/vimfx.properties index 415dc8f..6f867f9 100644 --- a/extension/locale/sv-SE/vimfx.properties +++ b/extension/locale/sv-SE/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx är i %S. Klicka för att återvända till %S. help.title=Tangentbordskommandon help.search=Sök +help.last_hint_char=sista_etikettstecken mode.normal=Normalläge @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=Rotera överlappande etiketter bakåt mode.hints.delete_hint_char=Radera senast inmatade tecken mode.hints.increase_count=Öka antal mode.hints.toggle_complementary=Ge etiketter till alla andra element +mode.hints.peek_through=Håll ned för att se igenom etiketter +mode.hints.toggle_in_tab=Växla mellan att öppna en länk i ny flik eller inte +mode.hints.toggle_in_background=Växla mellan att öppna en länk i bakgrunds- eller förgrundsflik mode.ignore=Ignoreringsläge mode.ignore.exit=Återvänd till Normalläge diff --git a/extension/locale/zh-CN/vimfx.properties b/extension/locale/zh-CN/vimfx.properties index 9622ac3..1fb5df0 100644 --- a/extension/locale/zh-CN/vimfx.properties +++ b/extension/locale/zh-CN/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx 处于 %S. 点击返回 %S. help.title=键盘快捷键 help.search=搜索 +help.last_hint_char=last_hint_char mode.normal=普通模式 @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=向后旋转重叠的标记 mode.hints.delete_hint_char=删除最后输入的提示符 mode.hints.increase_count=递增计数 mode.hints.toggle_complementary=标记所有其他元素 +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=忽略模式 mode.ignore.exit=返回普通模式 diff --git a/extension/locale/zh-TW/vimfx.properties b/extension/locale/zh-TW/vimfx.properties index 10b26dc..6055639 100644 --- a/extension/locale/zh-TW/vimfx.properties +++ b/extension/locale/zh-TW/vimfx.properties @@ -3,6 +3,7 @@ button.tooltip.other_mode=VimFx 處於 %S. 點擊返回 %S. help.title=鍵盤快速鍵 help.search=搜尋 +help.last_hint_char=last_hint_char mode.normal=普通模式 @@ -117,6 +118,9 @@ mode.hints.rotate_markers_backward=向後旋轉重疊的標誌 mode.hints.delete_hint_char=刪除最後輸入的提示字元 mode.hints.increase_count=遞增計數 mode.hints.toggle_complementary=標記其他所有元素 +mode.hints.peek_through=Hold to peek through markers +mode.hints.toggle_in_tab=Toggle whether to open a link in a new tab or not +mode.hints.toggle_in_background=Toggle whether to open a link in a background or foreground tab mode.ignore=忽略模式 mode.ignore.exit=回到正常模式 diff --git a/extension/skin/style.css b/extension/skin/style.css index c56f94a..511def0 100644 --- a/extension/skin/style.css +++ b/extension/skin/style.css @@ -282,10 +282,13 @@ toolbarpaletteitem[place="palette"] > #VimFxButton { clear: left; width: 100%; margin-top: 0.2em; - cursor: pointer; } - #VimFxHelpDialogContainer .command:hover * { + #VimFxHelpDialogContainer .command.has-click { + cursor: pointer; + } + + #VimFxHelpDialogContainer .command.has-click:hover * { text-decoration: underline; } -- 2.39.3