aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-06-06 20:10:13 +0100
committerStephen Blott2015-06-06 20:10:13 +0100
commitc20e5d44455be8ac885f0d7c42e05ec9857bd203 (patch)
tree08e86ce27bac43dbed06145d6fef17386bd11c94 /background_scripts
parentf3aeb81e6822fd9e0f3ab40ddde4e68881d92a21 (diff)
parentdce6e0954d0f1e767b7c9dafd538541ceaee8412 (diff)
downloadvimium-c20e5d44455be8ac885f0d7c42e05ec9857bd203.tar.bz2
Merge pull request #1715 from smblott-github/help-page-long-bindings
On the help page, use separate row for very-long bindings.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee27
1 files changed, 18 insertions, 9 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index cbb70c6c..835b8a9a 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -150,17 +150,26 @@ helpDialogHtmlForCommandGroup = (group, commandsToKey, availableCommands,
bindings = (commandsToKey[command] || [""]).join(", ")
if (showUnboundCommands || commandsToKey[command])
isAdvanced = Commands.advancedCommands.indexOf(command) >= 0
- html.push(
- "<tr class='vimiumReset #{"advanced" if isAdvanced}'>",
- "<td class='vimiumReset'>", Utils.escapeHtml(bindings), "</td>",
- "<td class='vimiumReset'>:</td><td class='vimiumReset'>", availableCommands[command].description)
-
- if (showCommandNames)
- html.push("<span class='vimiumReset commandName'>(#{command})</span>")
-
- html.push("</td></tr>")
+ description = availableCommands[command].description
+ if bindings.length < 12
+ helpDialogHtmlForCommand html, isAdvanced, bindings, description, showCommandNames, command
+ else
+ # If the length of the bindings is too long, then we display the bindings on a separate row from the
+ # description. This prevents the column alignment from becoming out of whack.
+ helpDialogHtmlForCommand html, isAdvanced, bindings, "", false, ""
+ helpDialogHtmlForCommand html, isAdvanced, "", description, showCommandNames, command
html.join("\n")
+helpDialogHtmlForCommand = (html, isAdvanced, bindings, description, showCommandNames, command) ->
+ html.push "<tr class='vimiumReset #{"advanced" if isAdvanced}'>"
+ if description
+ html.push "<td class='vimiumReset'>", Utils.escapeHtml(bindings), "</td>"
+ html.push "<td class='vimiumReset'>#{if description and bindings then ':' else ''}</td><td class='vimiumReset'>", description
+ html.push("<span class='vimiumReset commandName'>(#{command})</span>") if showCommandNames
+ else
+ html.push "<td class='vimiumReset' colspan='3' style='text-align: left;'>", Utils.escapeHtml(bindings)
+ html.push("</td></tr>")
+
#
# Fetches the contents of a file bundled with this extension.
#