If I have a command with the following Ruby code:
require ENV['TM_SUPPORT_PATH'] + '/lib/ui'
icon_plist = "{ tm_small = '/Applications/TextMate.app/Contents/Resources/TextMate Help/images/tm_small.png'; }" system(ENV['DIALOG'], "images", "--register", icon_plist) result = [{ 'match' => 'foo', 'display' => '12345', 'image' => 'tm_small' }] TextMate::UI.complete(result)
If I type "f" and invoke the command the completion menu will appear. But it looks like the menu doesn't take into account the width of the image since the "5" is cut off and there's no margin between the "4" and the edge of the menu.
— /Jacob Carlborg
On 6 Aug 2016, at 20:46, Jacob Carlborg wrote:
If I type "f" and invoke the command the completion menu will appear. But it looks like the menu doesn't take into account the width of the image since the "5" is cut off and there's no margin between the "4" and the edge of the menu.
The pop-up is using a table view so we must size the columns manually. I assume (but have not looked) that the current code just has a fixed width for the image column, rather than iterate all rows to find the maximum width.
A PR is of course more than welcome to improve this. I don’t think we have any existing code that actually makes use of the image functionality of the pop-up menu.
On 7 Aug 2016, at 16:11, Allan Odgaard wrote:
The pop-up is using a table view so we must size the columns manually. I assume (but have not looked) that the current code just has a fixed width for the image column, rather than iterate all rows to find the maximum width.
Just looked at the code and it’s using an image + text cell and does actually iterate each row but asks the cell using `cellSizeForBounds:NSMakeRect:` which does not account for the image, but just using `cellSize` does, so I’ll make that change.
On 07 Aug 2016, at 17:44, Allan Odgaard mailinglist@textmate.org wrote: Just looked at the code and it’s using an image + text cell and does actually iterate each row but asks the cell using cellSizeForBounds:NSMakeRect: which does not account for the image, but just using cellSize does, so I’ll make that change.
Thanks.
-- /Jacob Carlborg