install.fairie/dotfiles/.vim/plugged/vim-markdown/test/toc-autofit.vader
Git E2E Dev Test Username 78b956b821 git subrepo clone https://github.com/plasticboy/vim-markdown.git ./dotfiles/.vim/plugged/vim-markdown
subrepo:
  subdir:   "dotfiles/.vim/plugged/vim-markdown"
  merged:   "c3f83ebb"
upstream:
  origin:   "https://github.com/plasticboy/vim-markdown.git"
  branch:   "master"
  commit:   "c3f83ebb"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:36:20 -04:00

53 lines
798 B
Text

" Tests toc window auto-fit to longest header, but without exceeding half screen.
Given markdown;
# chap 1
# chap 2
# chap 3
# chap 4
# chap 5
# chap 6
# chap 7
# chap 8
# chap 9
# chap 10
# chap 11
# chap 12
## chap 12.1
### chap 12.1.1
#### chap 12.1.1.1
##### chap 12.1.1.1.1
###### chap 12.1.1.1.1.1
# chap 13
Execute (toc window autofit width):
set number
let g:vim_markdown_toc_autofit = 1
let line = '###### chap 12.1.1.1.1.1'
AssertEqual getline('33'), line
:Toc
let real_width = winwidth(0)
:lclose
let expected_width = len(line) + 2*5 + 1 + 3 - 7
AssertEqual real_width, expected_width
set nonumber
" 2 spaces * 5 additional header levels + 1 space for first header +
" 3 spaces for line numbers - 7 chars ('###### ') that don't show up on the TOC