[TxMt] DIALOG2 popup Question

Hans-Joerg Bibiko bibiko at eva.mpg.de
Wed Apr 16 15:31:07 UTC 2008


Dear DIALOG2 popup developer,

I have a problem ;)

I want to insert a character which could have several names like

↓	arrow down
←	arrow left
↑	arrow up
α	greek alpha
β	greek beta

My aim is to write e.g. "arrow" and the popup dialog shows all arrow  
matches (only the glyph). Then I want to choose one and instead of  
inserting "arrow" it should insert the chosen glyph. Fine. I tried it  
and I had partly success.

####
First problem:
for the suggestions I have to write:
{display="↓";match=down;},{display="↓";match=arrow;}

this leads, of course, to having two ↓ in the list.
Why not write:
{display="↓";matches=("down","arrow");}

In other words to allow more than one match.

####
Second problem:
If I want to do that I have to use the options -w for wait, because I  
want to replace e.g. "arrow" by my chosen glyph. Fine. But if I delete  
5 characters to show all suggestions I do not see what I'm writing  
whereby the popup menu does its job perfectly.

####
Third problem:
If I type e.g. "arr" the popup dialog finds all matches beginning with  
"arr". But it would be nice to have an option to show only those items  
matching exactly. E.g. I have to type "arrow" to show all 'arrow's not  
only "a" or "ar" etc.


##########
Here's a first naïve example command:
Input: Selected Text or Word
Output: Replace Selected Text
Command:

RES=$(echo '{suggestions=({display="↓";match=down;}, 
{display="↓";match=arrow;},{display="↑";match=arrow;}, 
{display="←";match=arrow;},{display="α";match=greek;}, 
{display="α";match=alpha;},{display="β";match=greek;}, 
{display="β";match=beta;});}' | "$DIALOG" popup -iwf  
"$TM_CURRENT_WORD")

RES=$(echo "$RES" | grep display | perl -Xpe 's/.*?display = "(.*?)";/ 
$1/;s/\\U([0-9A-F]+)/chr(hex($1))/iesg;')

echo -n "$RES"

My overall aim is to provide a possibility to insert a glyph by  
looking for words in its Unicode name.

Or is the DIALOG2 popup dialog not the right tool for it, meaning  
should one write its own rountine for that?
Or is there a better way to do it?

Thanks a lot for any hints in advance!

--Hans


-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIALOG2 popup.tmCommand
Type: application/octet-stream
Size: 1109 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080416/e74342c1/attachment.tmCommand>
-------------- next part --------------





More information about the textmate mailing list