Sublime Forum

set_layout drawbacks

#1

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:

-----------------
|       |       |
|       |       |
-----------------
|    |     |    |
|    |     |    |
----------------- 

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!

0 Likes

#2

@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.)

0 Likes

#3

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.

0 Likes

#4

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 :frowning:.

0 Likes

#5

It works just fine.

            "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]]
0 Likes

#6

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.

0 Likes

#7

cells can span multiple columns

0 Likes

#8

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.

0 Likes

#9

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.

0 Likes

#10

The first place you wanna go is here: 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.

0 Likes

#11

No, but as you delve deeper into uncharted territory, please consider documenting it and posting it on either the “Unofficial Docs” or the brand new “Knowledge Base”. Thanks!

Unofficial Docs: docs.sublimetext.info/
(github repo: github.com/SublimeText/UnofficialDocs )

Knowledge Base: kb.sublimetext.info/
(github repo: github.com/SublimeText/KnowledgeBase )

0 Likes

#12

Thank god you stuck in the [1] and [2] else I wouldn’t have been sure what you were talking about! :smile:

Unofficial Docs … FFFFFFFFFFFF … what does he mean???

0 Likes

#13

Makes it look more professional :smile:

Just like my awesome vocabulary (see Exhibit A for examples of my enhanced vocabulary.)

Exhibit A:

0 Likes

#14

Did you mean the “Unofficial Docs[1]” or the “Unofficial Docs[2]” ?

[1] docs.sublimetext.info/en/latest/ … xdefs.html

[2] sublimetext.info/docs/en/extensi … xdefs.html

[quote]Note

Sublime Text cannot reload syntax definitions automatically upon their modification[/quote]

0 Likes

#15

you win

0 Likes

#16

oooh! what’s the prize? a 512GB SSD ? yes pweaze

0 Likes

#17

Your prize…

I made you this sweater out of my tears. The tears of a failure…

0 Likes

#18

hahaha … I got nothing … couldn’t find a good respon(s|g)e bob …

0 Likes