view src/testdir/test_display.vim @ 10466:34b50194f82d v8.0.0126

commit https://github.com/vim/vim/commit/6270660611a151c5d0f614a5f0248ccdc80ed971 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 9 19:28:48 2016 +0100 patch 8.0.0126 Problem: Display problem with 'foldcolumn' and a wide character. (esiegerman) Solution: Don't use "extra" but an allocated buffer. (Christian Brabandt, closes #1310)
author Christian Brabandt <cb@256bit.org>
date Fri, 09 Dec 2016 19:30:04 +0100
parents
children 232a0d1d8f24
line wrap: on
line source

" Test for displaying stuff
if !has('gui_running') && has('unix')
  set term=ansi
endif

function! s:screenline(lnum, nr) abort
  let line = []
  for j in range(a:nr)
    for c in range(1, winwidth(0))
        call add(line, nr2char(screenchar(a:lnum+j, c)))
    endfor
    call add(line, "\n")
  endfor
  return join(line, '')
endfunction

function! Test_display_foldcolumn()
  new
  vnew
  vert resize 25

  1put='e more noise blah blah‚ more stuff here'

  let expect = "e more noise blah blah<82\n> more stuff here        \n"

  call cursor(2, 1)
  norm! zt
  redraw!
  call assert_equal(expect, s:screenline(1,2))
  set fdc=2
  redraw!
  let expect = "  e more noise blah blah<\n  82> more stuff here    \n"
  call assert_equal(expect, s:screenline(1,2))

  quit!
  quit!
endfunction