Home Download Buy Blog Forum Support

set_layout drawbacks

set_layout drawbacks

Postby jhaberstro on Wed Mar 07, 2012 2:09 am

Since there doesn't seem to be any documentation on the set_layout API, I'm trying to figure out the limitations of this function.

It seems the "cells" parameter of set_layout is a list of lists where each individual list contains an x1, y1, x2, y2 where each value must be an integer. However, there are additional constraints on the cells because layouts must be grid-like. That is, the following layout is impossible:

Code: Select all
-----------------
|       |       |
|       |       |
-----------------
|    |     |    |
|    |     |    |
-----------------


Because the top row's cells do not align with the bottom row's cells.

Am I correct this is a current limitation? And if it is, are there any plans to address this?

Thanks for any feedback!
jhaberstro
 
Posts: 4
Joined: Wed Mar 07, 2012 1:59 am

Re: set_layout drawbacks

Postby C0D312 on Wed Mar 07, 2012 2:18 am

@castles_made_of_sand! @castles_made_of_sand! @castles_made_of_sand! (if you say his name three times, he'll show up and answer your question.)
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: set_layout drawbacks

Postby facelessuser on Wed Mar 07, 2012 2:28 am

C0D312 wrote:@castles_made_of_sand! @castles_made_of_sand! @castles_made_of_sand! (if you say his name three times, he'll show up and answer your question.)


Oh you can't trick me, I saw Beetlejuice!

In all seriousness, if someone has an answer to this, it would be castles_made_of_sand; he spent a lot of time with layouts.
facelessuser
 
Posts: 1541
Joined: Tue Apr 05, 2011 7:38 pm

Re: set_layout drawbacks

Postby jhaberstro on Wed Mar 07, 2012 2:47 am

Hopefully he see's this thread then! I'm hoping to develop a window splitting plugin, similar to vim's vsplit and split functionality, but if what I've found is true then it seems it might be impossible :(.
jhaberstro
 
Posts: 4
Joined: Wed Mar 07, 2012 1:59 am

Re: set_layout drawbacks

Postby quarnster on Wed Mar 07, 2012 6:12 am

It works just fine.
Code: Select all
            "cols": [0.0, 0.33, 0.5, 0.66, 1.0],
            "rows": [0.0, 0.5, 1.0],
            "cells": [
                [0, 0, 2, 1], [2, 0, 4, 1],
                [0, 1, 1, 2], [1, 1, 3, 2], [3, 1, 4, 2]]
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: set_layout drawbacks

Postby jhaberstro on Wed Mar 07, 2012 8:01 am

I do not understand why the cols parameter works. Doesn't the 4 intervals (0.0-0.33, 0.33-0.5, 0.5-0.66, 0.66-1.0) designate 4 columns, but there are only 3? Maybe I am misunderstanding what cols and rows really represent.
jhaberstro
 
Posts: 4
Joined: Wed Mar 07, 2012 1:59 am

Re: set_layout drawbacks

Postby sublimator on Wed Mar 07, 2012 8:04 am

cells can span multiple columns
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: set_layout drawbacks

Postby sublimator on Wed Mar 07, 2012 8:19 am

If you wanna find the full 5 `cols` and make sense of it, just count all vertical lines you can see in the layout, including the outer edges, 0 and 1

As for limitations, splitting isn't a problem but closing cells (merging with adjacent ones) is.

It's hard to control where the views end up as the only way to identify groups is via their position in the `cells` array.

There's workarounds ... I'm pretty busy/exhausted atm else I'd go into detail.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: set_layout drawbacks

Postby jhaberstro on Wed Mar 07, 2012 10:18 pm

Ah, that makes sense. Thank you for the explanation.

Is there someway to discover undocumented APIs? I realize there is the Default/ directory but that certainly isn't extensive.
jhaberstro
 
Posts: 4
Joined: Wed Mar 07, 2012 1:59 am

Re: set_layout drawbacks

Postby sublimator on Wed Mar 07, 2012 11:04 pm

The first place you wanna go is here: http://www.sublimetext.com/docs/2/api_reference.html

Sometimes it doesn't have em all listed.

>>> import sublime
>>> help(sublime)

Can be useful for discovering unlisted apis, though once discovered you still have to poke/prod if you can't find docs for em.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Next

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests