diff options
author | David Bürgin <676c7473@gmail.com> | 2015-04-23 06:58:20 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-04-27 04:58:37 -0400 |
commit | 7f0764629495a5e0568ee625e8f89a8121235940 (patch) | |
tree | ae26eb62899ba168d10a17159c4fd1f25ae0af3b /test/functional/legacy | |
parent | ed464908e491234e4c474cb0277142f55532944e (diff) | |
download | rneovim-7f0764629495a5e0568ee625e8f89a8121235940.tar.gz rneovim-7f0764629495a5e0568ee625e8f89a8121235940.tar.bz2 rneovim-7f0764629495a5e0568ee625e8f89a8121235940.zip |
vim-patch:7.4.710
Problem: It is not possible to make spaces visibible in list mode.
Solution: Add the "space" item to 'listchars'. (David Bürgin, issue 350)
https://github.com/vim/vim/releases/tag/v7-4-710
Closes #2485.
Diffstat (limited to 'test/functional/legacy')
-rw-r--r-- | test/functional/legacy/listchars_spec.lua | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua new file mode 100644 index 0000000000..e6c64daed7 --- /dev/null +++ b/test/functional/legacy/listchars_spec.lua @@ -0,0 +1,96 @@ +-- Tests for 'listchars' display with 'list' and :list. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe("'listchars'", function() + before_each(clear) + + it("works with 'list'", function() + source([[ + function GetScreenCharsForLine(lnum) + return join(map(range(1, virtcol('$')), 'nr2char(screenchar(a:lnum, v:val))'), '') + endfunction + nnoremap <expr> GG ":call add(g:lines, GetScreenCharsForLine(".screenrow()."))\<CR>" + ]]) + + insert([[ + start: + aa + bb + cccc + dd ee + ]]) + + execute('let g:lines = []') + + -- Set up 'listchars', switch on 'list', and use the "GG" mapping to record + -- what the buffer lines look like. + execute('set listchars+=tab:>-,space:.,trail:<') + execute('set list') + execute('/^start:/') + execute('normal! jzt') + feed('GG<cr>') + feed('GG<cr>') + feed('GG<cr>') + feed('GG<cr>') + feed('GGH') + + -- Repeat without displaying "trail" spaces. + execute('set listchars-=trail:<') + feed('GG<cr>') + feed('GG<cr>') + feed('GG<cr>') + feed('GG<cr>') + feed('GG') + + -- Delete the buffer contents and :put the collected lines. + execute('%d') + execute('put =g:lines', '1d') + + -- Assert buffer contents. + expect([[ + >-------aa>-----$ + ..bb>---<<$ + ...cccc><$ + dd........ee<<>-$ + <$ + >-------aa>-----$ + ..bb>---..$ + ...cccc>.$ + dd........ee..>-$ + .$]]) + end) + + it('works with :list', function() + insert([[ + start: + fff + gg + h + iii ]]) + + -- Set up 'listchars', switch 'list' *off* (:list must show the 'listchars' + -- even when 'list' is off), then run :list and collect the output. + execute('set listchars+=tab:>-,space:.,trail:<') + execute('set nolist') + execute('/^start:/') + execute('redir! => g:lines') + execute('+1,$list') + execute('redir END') + + -- Delete the buffer contents and :put the collected lines. + execute('%d') + execute('put =g:lines', '1d') + + -- Assert buffer contents. + expect([[ + + + ..fff>--<<$ + >-------gg>-----$ + .....h>-$ + iii<<<<><<$]]) + end) +end) |