Skip to content

Commit

Permalink
Perform the search on selected text, if any
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou committed Sep 7, 2015
1 parent 7a1f4af commit 6c6d265
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Commands/Documentation for Word.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
<string>#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &amp;&amp; . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
if grep &lt;&lt;&lt;${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$'
term=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
if grep &lt;&lt;&lt;${term} -Esq '^[a-zA-Z0-9_]+$'
then
if URL=`grep -i "^$TM_CURRENT_WORD=" "$TM_BUNDLE_SUPPORT/documentation.txt"`
then
URL=${URL:${#TM_CURRENT_WORD}+1}
URL=${URL:${#term}+1}
else
URL="function.${TM_CURRENT_WORD//_/-}"
URL="function.${term//_/-}"
fi
if [[ "$PHP_MANUAL_LOCATION" ]]
then
Expand All @@ -26,7 +28,7 @@ if grep &lt;&lt;&lt;${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$'
fi
if [[ ! -f "$PHP_MANUAL_LOCATION/$URL.html" ]]
then
exit_show_tool_tip "No documentation found for '$TM_CURRENT_WORD'"
exit_show_tool_tip "No documentation found for '$term'"
fi
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "PHP Help" "${TM_FILENAME:-}"
Expand All @@ -49,7 +51,7 @@ if grep &lt;&lt;&lt;${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$'
historyList.appendChild(item);
item.selected = true;
}
function setupLinks() {
var link, links = document.links;
for (i = 0; i &lt; links.length; i++) {
Expand Down

0 comments on commit 6c6d265

Please sign in to comment.