Skip to content

Instantly share code, notes, and snippets.

@matu3ba
Last active April 15, 2023 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matu3ba/39d3624de1779584b5cfb2cbe0853513 to your computer and use it in GitHub Desktop.
Save matu3ba/39d3624de1779584b5cfb2cbe0853513 to your computer and use it in GitHub Desktop.
backtracking attempt for window view creation. Code would be ugly, so dont implement.
-- Simplified version only taking into account idenically sized splits
-- along a full rectangle:
-- Windows can be grouped by following the direction of window numbers.
-- 1. 2. 3.
-- 1 | 2 | | |1 |2 | | | 6 | 1 | 2 | 3 | 4|
-- ---|---| 5 | |-----| 4 | 5 |---- |--------------|
-- 3 | 4 | | | 3 | | | 7 | 5 |
-- 1. allowed, because even though 5 has no split, it has full height
-- 2. not allowed, because 3 has no vsplit
-- 4. not allowed, because splits in 1,2 are not identical in 3.
-- 1 | | 4 | |
-- --| 3 |---| 6 | 7
-- 2 | | 5 | | alternate for 1:
-- ----------------- 1 | 3 | |
-- 8 ---|---| 5 |
-- ----------------- 2 | 4 | |
-- 9
-- -----------------
-- 10
-- Then: Split order of alter for 1 can be recombined via grouping together
-- {1 spl 2} vspl {3 spl 4} vspl 5
-- Note: Reason is
-- |2|3| | |
-- |---|5| |
-- 1| 4 | |7| which makes things very convoluted.
-- |-----| |
-- | 6 | |
-- |--------
-- | 8 |
-- 2 cases: 1. is full width or full height or 2. has internal splits countable
-- as series (complex one 1, series(2..8).
-- for series: while(not (full width or full height)):
-- {op:item->next_item, 1:item, 2:next_item}
-- with item = curr_index, if next(next(curr_index)).winsize
-- Doesn not hold true unless introspection or backtracking!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment