]> 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:

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