Skip to content

Commit c421cbe

Browse files
committed
• Changed to use Dialog.menu (which now handles larger lists)
• General code cleanup git-svn-id: http://svn.textmate.org/trunk/Bundles/PHP.tmbundle@6729 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
1 parent dad0b62 commit c421cbe

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

Commands/Completion.tmCommand

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@
77
<key>command</key>
88
<string>#!/usr/bin/env ruby -wKU
99
10-
SUPPORT = ENV['TM_SUPPORT_PATH']
11-
DIALOG = SUPPORT + '/bin/tm_dialog'
12-
13-
require SUPPORT + '/lib/escape'
14-
require SUPPORT + '/lib/osx/plist'
10+
require ENV["TM_SUPPORT_PATH"] + "/lib/dialog.rb"
1511
1612
functions = `grep -i "^$TM_CURRENT_WORD" "$TM_BUNDLE_SUPPORT"/functions.txt`.split("\n")
1713
abort if functions.empty?
1814
1915
if functions.size &gt; 1
20-
functions = functions.collect {|e| { 'title' =&gt; e[/^.+?(?=%|$)/], 'data' =&gt; e } }
21-
plist = { 'menuItems' =&gt; functions }.to_plist
22-
23-
io = open("|#{e_sh DIALOG} -u", "r+")
24-
io &lt;&lt; plist
25-
io.close_write
26-
res = PropertyList::load(io.read)
27-
abort unless res.has_key? 'selectedMenuItem'
28-
choice = res['selectedMenuItem']['data']
16+
names = functions.map {|e| e[/^.+?(?=%|$)/] }
17+
abort unless choice = Dialog.menu(names)
18+
choice = functions[choice]
2919
else
3020
choice = functions.pop
3121
end

0 commit comments

Comments
 (0)