From 0f6b4f06dece71487a6d8546c50de775d9c8c287 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Aug 2018 16:56:34 +0200 Subject: patch 8.1.0307: there is no good way to get the window layout Problem: There is no good way to get the window layout. Solution: Add the winlayout() function. (Yegappan Lakshmanan) --- src/testdir/test_window_id.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/testdir/test_window_id.vim') diff --git a/src/testdir/test_window_id.vim b/src/testdir/test_window_id.vim index b3b506d04d..d10d831650 100644 --- a/src/testdir/test_window_id.vim +++ b/src/testdir/test_window_id.vim @@ -101,3 +101,23 @@ func Test_win_getid_curtab() call assert_equal(win_getid(1), win_getid(1, 1)) tabclose! endfunc + +func Test_winlayout() + let w1 = win_getid() + call assert_equal(['leaf', w1], winlayout()) + + split + let w2 = win_getid() + call assert_equal(['col', [['leaf', w2], ['leaf', w1]]], winlayout()) + + split + let w3 = win_getid() + call assert_equal(['col', [['leaf', w3], ['leaf', w2], ['leaf', w1]]], winlayout()) + + 2wincmd w + vsplit + let w4 = win_getid() + call assert_equal(['col', [['leaf', w3], ['row', [['leaf', w4], ['leaf', w2]]], ['leaf', w1]]], winlayout()) + + only! +endfunc -- cgit v1.2.3