On 9 Jan 2009, at 14:23, dreamcat7 wrote:
- We chopped the input into only one word so the script can handle
it better and not throw to the tooltip a big error. I put this stripping / to the query string, however it really should move to the search_docs(query) command, where we are executing the search. Sorry but I did add to there and break the ruby code.
Ctrl-H --> documentation_for_word() --> search_docs_all(query) --> search_docs(query)** --> docsetutil Ctrl-H --> documentation_for_word() --> search_docs_all(query) --> man_page(query)** --> man
- If we keep the full string in query variable, then when we print
the tooltip, we can show the full text back to the user. As it stands we show back the doctored text, i.e. the first word or line of the selected text.
I think the user should see the term that was actually searched for, rather than the full (selected) text.
There is however a minor gotcha when presenting the dialog, here it has the doctored text, which might not make it very clear from where the text comes from (since only the first word is shown).
- With the latest (above) the command it still may not execute
right for conditions where there are spaces, tabs, or newline characters etc before the text point. So cleaning up the input should be tested and tweaked some more.
I believe I fixed that in the version I committed (I did make a few changes compared to your latest version).
- If the word is wrapped in square brackets. e.g. [NSArray] - then
TM_SELECTED_TEXT will not work but TM_CURRENT_WORD will. Again, a better place to sanitize this input may be either search_docs(query) or search_docs_all(query)
I think this is actually because the scope of this selection has it call a different documentation lookup function (the one for selectors).
- If we have just run the command (Ctrl-H) then we have opened a
Web-window and not a text window. Can we press Ctrl-H here (in the html window) to bring up the dialog again to perform another search?
In theory, yes. But it would require doctoring the presented page (to handle a key down event on ⌃H and use TextMate.system() to open the dialog etc.) — it might be better to leave it be and wait for a more general re-run ability for commands with HTML output.
- As Allan wants we will show the search box only conditionally,
when there isnt a current word on the caret. However it would be a nice option to have for those who always want to show it. This may sound like a personal request, however i would be very grateful because pressing Ctrl-W is very much more difficult with RSI than to press enter key with the dialog [...]
Why do you need to press ⌃W?