]> git.madduck.net Git - etc/vim.git/blob - test/toc-autofit.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge pull request #269 from yous/relaxed-fenced-code
[etc/vim.git] / test / toc-autofit.vader
1 " Tests toc window auto-fit to longest header, but without exceeding half screen.
2
3 Given markdown;
4 # chap 1
5
6 # chap 2
7
8 # chap 3
9
10 # chap 4
11
12 # chap 5
13
14 # chap 6
15
16 # chap 7
17
18 # chap 8
19
20 # chap 9
21
22 # chap 10
23
24 # chap 11
25
26 # chap 12
27
28 ## chap 12.1
29
30 ### chap 12.1.1
31
32 #### chap 12.1.1.1
33
34 ##### chap 12.1.1.1.1
35
36 ###### chap 12.1.1.1.1.1
37
38 # chap 13
39
40 Execute (toc window autofit width):
41   set number
42   let g:vim_markdown_toc_autofit = 1
43   let line = '###### chap 12.1.1.1.1.1'
44   AssertEqual getline('33'), line
45   :Toc
46   let real_width = winwidth(0)
47   :lclose
48   let expected_width = len(line) + 2*5 + 1 + 3 - 7
49   AssertEqual real_width, expected_width
50   set nonumber
51 " 2 spaces * 5 additional header levels + 1 space for first header +
52 " 3 spaces for line numbers - 7 chars ('###### ') that don't show up on the TOC
53