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