test_breakindent.vim 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. " Test for breakindent
  2. "
  3. " Note: if you get strange failures when adding new tests, it might be that
  4. " while the test is run, the breakindent caching gets in its way.
  5. " It helps to change the tabstop setting and force a redraw (e.g. see
  6. " Test_breakindent08())
  7. source check.vim
  8. CheckOption breakindent
  9. source view_util.vim
  10. source screendump.vim
  11. func SetUp()
  12. let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"
  13. endfunc
  14. func s:screen_lines(lnum, width) abort
  15. return ScreenLines([a:lnum, a:lnum + 2], a:width)
  16. endfunc
  17. func s:screen_lines2(lnums, lnume, width) abort
  18. return ScreenLines([a:lnums, a:lnume], a:width)
  19. endfunc
  20. func s:compare_lines(expect, actual)
  21. call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
  22. endfunc
  23. func s:test_windows(...)
  24. call NewWindow(10, 20)
  25. setl ts=4 sw=4 sts=4 breakindent
  26. put =s:input
  27. exe get(a:000, 0, '')
  28. endfunc
  29. func s:close_windows(...)
  30. call CloseWindow()
  31. exe get(a:000, 0, '')
  32. endfunc
  33. func Test_breakindent01()
  34. " simple breakindent test
  35. call s:test_windows('setl briopt=min:0')
  36. let lines = s:screen_lines(line('.'),8)
  37. let expect = [
  38. \ " abcd",
  39. \ " qrst",
  40. \ " GHIJ",
  41. \ ]
  42. call s:compare_lines(expect, lines)
  43. call s:close_windows()
  44. endfunc
  45. func Test_breakindent01_vartabs()
  46. " like 01 but with vartabs feature
  47. if !has("vartabs")
  48. return
  49. endif
  50. call s:test_windows('setl briopt=min:0 vts=4')
  51. let lines = s:screen_lines(line('.'),8)
  52. let expect = [
  53. \ " abcd",
  54. \ " qrst",
  55. \ " GHIJ",
  56. \ ]
  57. call s:compare_lines(expect, lines)
  58. call s:close_windows('set vts&')
  59. endfunc
  60. func Test_breakindent02()
  61. " simple breakindent test with showbreak set
  62. set sbr=>>
  63. call s:test_windows('setl briopt=min:0 sbr=')
  64. let lines = s:screen_lines(line('.'),8)
  65. let expect = [
  66. \ " abcd",
  67. \ " >>qr",
  68. \ " >>EF",
  69. \ ]
  70. call s:compare_lines(expect, lines)
  71. call s:close_windows('set sbr=')
  72. endfunc
  73. func Test_breakindent02_vartabs()
  74. if !has("vartabs")
  75. return
  76. endif
  77. " simple breakindent test with showbreak set
  78. call s:test_windows('setl briopt=min:0 sbr=>> vts=4')
  79. let lines = s:screen_lines(line('.'), 8)
  80. let expect = [
  81. \ " abcd",
  82. \ " >>qr",
  83. \ " >>EF",
  84. \ ]
  85. call s:compare_lines(expect, lines)
  86. call s:close_windows('set sbr= vts&')
  87. endfunc
  88. func Test_breakindent03()
  89. " simple breakindent test with showbreak set and briopt including sbr
  90. call s:test_windows('setl briopt=sbr,min:0 sbr=++')
  91. let lines = s:screen_lines(line('.'), 8)
  92. let expect=[
  93. \ " abcd",
  94. \ "++ qrst",
  95. \ "++ GHIJ",
  96. \ ]
  97. call s:compare_lines(expect, lines)
  98. " clean up
  99. call s:close_windows('set sbr=')
  100. endfunc
  101. func Test_breakindent03_vartabs()
  102. " simple breakindent test with showbreak set and briopt including sbr
  103. if !has("vartabs")
  104. return
  105. endif
  106. call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4')
  107. let lines = s:screen_lines(line('.'), 8)
  108. let expect = [
  109. \ " abcd",
  110. \ "++ qrst",
  111. \ "++ GHIJ",
  112. \ ]
  113. call s:compare_lines(expect, lines)
  114. " clean up
  115. call s:close_windows('set sbr= vts&')
  116. endfunc
  117. func Test_breakindent04()
  118. " breakindent set with min width 18
  119. set sbr=<<<
  120. call s:test_windows('setl sbr=NONE briopt=min:18')
  121. let lines = s:screen_lines(line('.'), 8)
  122. let expect = [
  123. \ " abcd",
  124. \ " qrstuv",
  125. \ " IJKLMN",
  126. \ ]
  127. call s:compare_lines(expect, lines)
  128. " clean up
  129. call s:close_windows('set sbr=')
  130. set sbr=
  131. endfunc
  132. func Test_breakindent04_vartabs()
  133. " breakindent set with min width 18
  134. if !has("vartabs")
  135. return
  136. endif
  137. call s:test_windows('setl sbr= briopt=min:18 vts=4')
  138. let lines = s:screen_lines(line('.'), 8)
  139. let expect = [
  140. \ " abcd",
  141. \ " qrstuv",
  142. \ " IJKLMN",
  143. \ ]
  144. call s:compare_lines(expect, lines)
  145. " clean up
  146. call s:close_windows('set sbr= vts&')
  147. endfunc
  148. func Test_breakindent05()
  149. " breakindent set and shift by 2
  150. call s:test_windows('setl briopt=shift:2,min:0')
  151. let lines = s:screen_lines(line('.'),8)
  152. let expect = [
  153. \ " abcd",
  154. \ " qr",
  155. \ " EF",
  156. \ ]
  157. call s:compare_lines(expect, lines)
  158. call s:close_windows()
  159. endfunc
  160. func Test_breakindent05_vartabs()
  161. " breakindent set and shift by 2
  162. if !has("vartabs")
  163. return
  164. endif
  165. call s:test_windows('setl briopt=shift:2,min:0 vts=4')
  166. let lines = s:screen_lines(line('.'),8)
  167. let expect = [
  168. \ " abcd",
  169. \ " qr",
  170. \ " EF",
  171. \ ]
  172. call s:compare_lines(expect, lines)
  173. call s:close_windows('set vts&')
  174. endfunc
  175. func Test_breakindent06()
  176. " breakindent set and shift by -1
  177. call s:test_windows('setl briopt=shift:-1,min:0')
  178. let lines = s:screen_lines(line('.'),8)
  179. let expect = [
  180. \ " abcd",
  181. \ " qrstu",
  182. \ " HIJKL",
  183. \ ]
  184. call s:compare_lines(expect, lines)
  185. call s:close_windows()
  186. endfunc
  187. func Test_breakindent06_vartabs()
  188. " breakindent set and shift by -1
  189. if !has("vartabs")
  190. return
  191. endif
  192. call s:test_windows('setl briopt=shift:-1,min:0 vts=4')
  193. let lines = s:screen_lines(line('.'),8)
  194. let expect = [
  195. \ " abcd",
  196. \ " qrstu",
  197. \ " HIJKL",
  198. \ ]
  199. call s:compare_lines(expect, lines)
  200. call s:close_windows('set vts&')
  201. endfunc
  202. func Test_breakindent07()
  203. " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
  204. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n')
  205. let lines = s:screen_lines(line('.'),10)
  206. let expect = [
  207. \ " 2 ab",
  208. \ "? m",
  209. \ "? x",
  210. \ ]
  211. call s:compare_lines(expect, lines)
  212. " clean up
  213. call s:close_windows('set sbr= cpo-=n')
  214. endfunc
  215. func Test_breakindent07_vartabs()
  216. if !has("vartabs")
  217. return
  218. endif
  219. " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
  220. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4')
  221. let lines = s:screen_lines(line('.'),10)
  222. let expect = [
  223. \ " 2 ab",
  224. \ "? m",
  225. \ "? x",
  226. \ ]
  227. call s:compare_lines(expect, lines)
  228. " clean up
  229. call s:close_windows('set sbr= cpo-=n vts&')
  230. endfunc
  231. func Test_breakindent07a()
  232. " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
  233. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
  234. let lines = s:screen_lines(line('.'),10)
  235. let expect = [
  236. \ " 2 ab",
  237. \ " ? m",
  238. \ " ? x",
  239. \ ]
  240. call s:compare_lines(expect, lines)
  241. " clean up
  242. call s:close_windows('set sbr=')
  243. endfunc
  244. func Test_breakindent07a_vartabs()
  245. if !has("vartabs")
  246. return
  247. endif
  248. " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
  249. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4')
  250. let lines = s:screen_lines(line('.'),10)
  251. let expect = [
  252. \ " 2 ab",
  253. \ " ? m",
  254. \ " ? x",
  255. \ ]
  256. call s:compare_lines(expect, lines)
  257. " clean up
  258. call s:close_windows('set sbr= vts&')
  259. endfunc
  260. func Test_breakindent08()
  261. " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
  262. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4')
  263. " make sure, cache is invalidated!
  264. set ts=8
  265. redraw!
  266. set ts=4
  267. redraw!
  268. let lines = s:screen_lines(line('.'),10)
  269. let expect = [
  270. \ " 2 ^Iabcd",
  271. \ "# opq",
  272. \ "# BCD",
  273. \ ]
  274. call s:compare_lines(expect, lines)
  275. call s:close_windows('set sbr= cpo-=n')
  276. endfunc
  277. func Test_breakindent08_vartabs()
  278. if !has("vartabs")
  279. return
  280. endif
  281. " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
  282. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4')
  283. " make sure, cache is invalidated!
  284. set ts=8
  285. redraw!
  286. set ts=4
  287. redraw!
  288. let lines = s:screen_lines(line('.'),10)
  289. let expect = [
  290. \ " 2 ^Iabcd",
  291. \ "# opq",
  292. \ "# BCD",
  293. \ ]
  294. call s:compare_lines(expect, lines)
  295. call s:close_windows('set sbr= cpo-=n vts&')
  296. endfunc
  297. func Test_breakindent08a()
  298. " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
  299. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list')
  300. let lines = s:screen_lines(line('.'),10)
  301. let expect = [
  302. \ " 2 ^Iabcd",
  303. \ " # opq",
  304. \ " # BCD",
  305. \ ]
  306. call s:compare_lines(expect, lines)
  307. call s:close_windows('set sbr=')
  308. endfunc
  309. func Test_breakindent08a_vartabs()
  310. if !has("vartabs")
  311. return
  312. endif
  313. " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
  314. call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4')
  315. let lines = s:screen_lines(line('.'),10)
  316. let expect = [
  317. \ " 2 ^Iabcd",
  318. \ " # opq",
  319. \ " # BCD",
  320. \ ]
  321. call s:compare_lines(expect, lines)
  322. call s:close_windows('set sbr= vts&')
  323. endfunc
  324. func Test_breakindent09()
  325. " breakindent set and shift by 1, Number and list set sbr=#
  326. call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list')
  327. let lines = s:screen_lines(line('.'),10)
  328. let expect = [
  329. \ " 2 ^Iabcd",
  330. \ " #op",
  331. \ " #AB",
  332. \ ]
  333. call s:compare_lines(expect, lines)
  334. call s:close_windows('set sbr=')
  335. endfunc
  336. func Test_breakindent09_vartabs()
  337. if !has("vartabs")
  338. return
  339. endif
  340. " breakindent set and shift by 1, Number and list set sbr=#
  341. call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4')
  342. let lines = s:screen_lines(line('.'),10)
  343. let expect = [
  344. \ " 2 ^Iabcd",
  345. \ " #op",
  346. \ " #AB",
  347. \ ]
  348. call s:compare_lines(expect, lines)
  349. call s:close_windows('set sbr= vts&')
  350. endfunc
  351. func Test_breakindent10()
  352. " breakindent set, Number set sbr=~
  353. call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
  354. " make sure, cache is invalidated!
  355. set ts=8
  356. redraw!
  357. set ts=4
  358. redraw!
  359. let lines = s:screen_lines(line('.'),10)
  360. let expect = [
  361. \ " 2 ab",
  362. \ "~ mn",
  363. \ "~ yz",
  364. \ ]
  365. call s:compare_lines(expect, lines)
  366. call s:close_windows('set sbr= cpo-=n')
  367. endfunc
  368. func Test_breakindent10_vartabs()
  369. if !has("vartabs")
  370. return
  371. endif
  372. " breakindent set, Number set sbr=~
  373. call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4')
  374. " make sure, cache is invalidated!
  375. set ts=8
  376. redraw!
  377. set ts=4
  378. redraw!
  379. let lines = s:screen_lines(line('.'),10)
  380. let expect = [
  381. \ " 2 ab",
  382. \ "~ mn",
  383. \ "~ yz",
  384. \ ]
  385. call s:compare_lines(expect, lines)
  386. call s:close_windows('set sbr= cpo-=n vts&')
  387. endfunc
  388. func Test_breakindent11()
  389. " test strdisplaywidth()
  390. call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
  391. let text = getline(2)
  392. let width = strlen(text[1:]) + indent(2) + strlen(&sbr) * 3 " text wraps 3 times
  393. call assert_equal(width, strdisplaywidth(text))
  394. call s:close_windows('set sbr=')
  395. call assert_equal(4, strdisplaywidth("\t", 4))
  396. endfunc
  397. func Test_breakindent11_vartabs()
  398. if !has("vartabs")
  399. return
  400. endif
  401. " test strdisplaywidth()
  402. call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4')
  403. let text = getline(2)
  404. let width = strlen(text[1:]) + 2->indent() + strlen(&sbr) * 3 " text wraps 3 times
  405. call assert_equal(width, text->strdisplaywidth())
  406. call s:close_windows('set sbr= vts&')
  407. endfunc
  408. func Test_breakindent12()
  409. " test breakindent with long indent
  410. let s:input="\t\t\t\t\t{"
  411. call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>-')
  412. let lines = s:screen_lines(2,16)
  413. let expect = [
  414. \ " 2 >--->--->--->",
  415. \ " ---{ ",
  416. \ "~ ",
  417. \ ]
  418. call s:compare_lines(expect, lines)
  419. call s:close_windows('set nuw=4 listchars&')
  420. endfunc
  421. func Test_breakindent12_vartabs()
  422. if !has("vartabs")
  423. return
  424. endif
  425. " test breakindent with long indent
  426. let s:input = "\t\t\t\t\t{"
  427. call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4')
  428. let lines = s:screen_lines(2,16)
  429. let expect = [
  430. \ " 2 >--->--->--->",
  431. \ " ---{ ",
  432. \ "~ ",
  433. \ ]
  434. call s:compare_lines(expect, lines)
  435. call s:close_windows('set nuw=4 listchars& vts&')
  436. endfunc
  437. func Test_breakindent13()
  438. let s:input = ""
  439. call s:test_windows('setl breakindent briopt=min:10 ts=8')
  440. vert resize 20
  441. call setline(1, [" a\tb\tc\td\te", " z y x w v"])
  442. 1
  443. norm! fbgj"ayl
  444. 2
  445. norm! fygj"byl
  446. call assert_equal('d', @a)
  447. call assert_equal('w', @b)
  448. call s:close_windows()
  449. endfunc
  450. func Test_breakindent13_vartabs()
  451. if !has("vartabs")
  452. return
  453. endif
  454. let s:input = ""
  455. call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8')
  456. vert resize 20
  457. call setline(1, [" a\tb\tc\td\te", " z y x w v"])
  458. 1
  459. norm! fbgj"ayl
  460. 2
  461. norm! fygj"byl
  462. call assert_equal('d', @a)
  463. call assert_equal('w', @b)
  464. call s:close_windows('set vts&')
  465. endfunc
  466. func Test_breakindent14()
  467. let s:input = ""
  468. call s:test_windows('setl breakindent briopt= ts=8')
  469. vert resize 30
  470. norm! 3a1234567890
  471. norm! a abcde
  472. exec "norm! 0\<C-V>tex"
  473. let lines = s:screen_lines(line('.'),8)
  474. let expect = [
  475. \ "e ",
  476. \ "~ ",
  477. \ "~ ",
  478. \ ]
  479. call s:compare_lines(expect, lines)
  480. call s:close_windows()
  481. endfunc
  482. func Test_breakindent14_vartabs()
  483. if !has("vartabs")
  484. return
  485. endif
  486. let s:input = ""
  487. call s:test_windows('setl breakindent briopt= ts=8 vts=8')
  488. vert resize 30
  489. norm! 3a1234567890
  490. norm! a abcde
  491. exec "norm! 0\<C-V>tex"
  492. let lines = s:screen_lines(line('.'),8)
  493. let expect = [
  494. \ "e ",
  495. \ "~ ",
  496. \ "~ ",
  497. \ ]
  498. call s:compare_lines(expect, lines)
  499. call s:close_windows('set vts&')
  500. endfunc
  501. func Test_breakindent15()
  502. let s:input = ""
  503. call s:test_windows('setl breakindent briopt= ts=8 sw=8')
  504. vert resize 30
  505. norm! 4a1234567890
  506. exe "normal! >>\<C-V>3f0x"
  507. let lines = s:screen_lines(line('.'),20)
  508. let expect = [
  509. \ " 1234567890 ",
  510. \ "~ ",
  511. \ "~ ",
  512. \ ]
  513. call s:compare_lines(expect, lines)
  514. call s:close_windows()
  515. endfunc
  516. func Test_breakindent15_vartabs()
  517. if !has("vartabs")
  518. return
  519. endif
  520. let s:input = ""
  521. call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8')
  522. vert resize 30
  523. norm! 4a1234567890
  524. exe "normal! >>\<C-V>3f0x"
  525. let lines = s:screen_lines(line('.'),20)
  526. let expect = [
  527. \ " 1234567890 ",
  528. \ "~ ",
  529. \ "~ ",
  530. \ ]
  531. call s:compare_lines(expect, lines)
  532. call s:close_windows('set vts&')
  533. endfunc
  534. func Test_breakindent16()
  535. " Check that overlong lines are indented correctly.
  536. let s:input = ""
  537. call s:test_windows('setl breakindent briopt=min:0 ts=4')
  538. call setline(1, "\t".repeat("1234567890", 10))
  539. resize 6
  540. norm! 1gg$
  541. redraw!
  542. let lines = s:screen_lines(1,10)
  543. let expect = [
  544. \ "<<< 789012",
  545. \ " 345678",
  546. \ " 901234",
  547. \ ]
  548. call s:compare_lines(expect, lines)
  549. let lines = s:screen_lines(4,10)
  550. let expect = [
  551. \ " 567890",
  552. \ " 123456",
  553. \ " 7890 ",
  554. \ ]
  555. call s:compare_lines(expect, lines)
  556. call s:close_windows()
  557. endfunc
  558. func Test_breakindent16_vartabs()
  559. if !has("vartabs")
  560. return
  561. endif
  562. " Check that overlong lines are indented correctly.
  563. let s:input = ""
  564. call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4')
  565. call setline(1, "\t".repeat("1234567890", 10))
  566. resize 6
  567. norm! 1gg$
  568. redraw!
  569. let lines = s:screen_lines(1,10)
  570. let expect = [
  571. \ "<<< 789012",
  572. \ " 345678",
  573. \ " 901234",
  574. \ ]
  575. call s:compare_lines(expect, lines)
  576. let lines = s:screen_lines(4,10)
  577. let expect = [
  578. \ " 567890",
  579. \ " 123456",
  580. \ " 7890 ",
  581. \ ]
  582. call s:compare_lines(expect, lines)
  583. call s:close_windows('set vts&')
  584. endfunc
  585. func Test_breakindent17_vartabs()
  586. if !has("vartabs")
  587. return
  588. endif
  589. let s:input = ""
  590. call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++')
  591. call setline(1, "\t" . repeat('a', 63))
  592. vert resize 30
  593. norm! 1gg$
  594. redraw!
  595. let lines = s:screen_lines(1, 30)
  596. let expect = [
  597. \ "<-->aaaaaaaaaaaaaaaaaaaaaaaaaa",
  598. \ " +++aaaaaaaaaaaaaaaaaaaaaaa",
  599. \ " +++aaaaaaaaaaaaaa ",
  600. \ ]
  601. call s:compare_lines(expect, lines)
  602. call s:close_windows('set breakindent& list& listchars& showbreak&')
  603. endfunc
  604. func Test_breakindent18_vartabs()
  605. if !has("vartabs")
  606. return
  607. endif
  608. let s:input = ""
  609. call s:test_windows('setl breakindent list listchars=tab:<->')
  610. call setline(1, "\t" . repeat('a', 63))
  611. vert resize 30
  612. norm! 1gg$
  613. redraw!
  614. let lines = s:screen_lines(1, 30)
  615. let expect = [
  616. \ "<-->aaaaaaaaaaaaaaaaaaaaaaaaaa",
  617. \ " aaaaaaaaaaaaaaaaaaaaaaaaaa",
  618. \ " aaaaaaaaaaa ",
  619. \ ]
  620. call s:compare_lines(expect, lines)
  621. call s:close_windows('set breakindent& list& listchars&')
  622. endfunc
  623. func Test_breakindent19_sbr_nextpage()
  624. let s:input = ""
  625. call s:test_windows('setl breakindent briopt=shift:2,sbr,min:18 sbr=>')
  626. call setline(1, repeat('a', 200))
  627. norm! 1gg
  628. redraw!
  629. let lines = s:screen_lines(1, 20)
  630. let expect = [
  631. \ "aaaaaaaaaaaaaaaaaaaa",
  632. \ "> aaaaaaaaaaaaaaaaaa",
  633. \ "> aaaaaaaaaaaaaaaaaa",
  634. \ ]
  635. call s:compare_lines(expect, lines)
  636. " Scroll down one screen line
  637. setl scrolloff=5
  638. norm! 5gj
  639. let lines = s:screen_lines(1, 20)
  640. let expect = [
  641. \ "aaaaaaaaaaaaaaaaaaaa",
  642. \ "> aaaaaaaaaaaaaaaaaa",
  643. \ "> aaaaaaaaaaaaaaaaaa",
  644. \ ]
  645. call s:compare_lines(expect, lines)
  646. redraw!
  647. " moving the cursor doesn't change the text offset
  648. norm! l
  649. redraw!
  650. let lines = s:screen_lines(1, 20)
  651. call s:compare_lines(expect, lines)
  652. setl breakindent briopt=min:18 sbr=>
  653. norm! 5gj
  654. let lines = s:screen_lines(1, 20)
  655. let expect = [
  656. \ ">aaaaaaaaaaaaaaaaaaa",
  657. \ ">aaaaaaaaaaaaaaaaaaa",
  658. \ ">aaaaaaaaaaaaaaaaaaa",
  659. \ ]
  660. call s:compare_lines(expect, lines)
  661. call s:close_windows('set breakindent& briopt& sbr&')
  662. endfunc
  663. func Test_breakindent20_cpo_n_nextpage()
  664. let s:input = ""
  665. call s:test_windows('setl breakindent briopt=min:14 cpo+=n number')
  666. call setline(1, repeat('abcdefghijklmnopqrst', 10))
  667. norm! 1gg
  668. redraw!
  669. let lines = s:screen_lines(1, 20)
  670. let expect = [
  671. \ " 1 abcdefghijklmnop",
  672. \ " qrstabcdefghijkl",
  673. \ " mnopqrstabcdefgh",
  674. \ ]
  675. call s:compare_lines(expect, lines)
  676. " Scroll down one screen line
  677. setl scrolloff=5
  678. norm! 6gj
  679. redraw!
  680. let lines = s:screen_lines(1, 20)
  681. let expect = [
  682. \ "<<< qrstabcdefghijkl",
  683. \ " mnopqrstabcdefgh",
  684. \ " ijklmnopqrstabcd",
  685. \ ]
  686. call s:compare_lines(expect, lines)
  687. setl briopt+=shift:2
  688. norm! 1gg
  689. let lines = s:screen_lines(1, 20)
  690. let expect = [
  691. \ " 1 abcdefghijklmnop",
  692. \ " qrstabcdefghij",
  693. \ " klmnopqrstabcd",
  694. \ ]
  695. call s:compare_lines(expect, lines)
  696. " Scroll down one screen line
  697. norm! 6gj
  698. let lines = s:screen_lines(1, 20)
  699. let expect = [
  700. \ "<<< qrstabcdefghij",
  701. \ " klmnopqrstabcd",
  702. \ " efghijklmnopqr",
  703. \ ]
  704. call s:compare_lines(expect, lines)
  705. call s:close_windows('set breakindent& briopt& cpo& number&')
  706. endfunc
  707. func Test_breakindent20_list()
  708. call s:test_windows('setl breakindent breakindentopt= linebreak')
  709. " default:
  710. call setline(1, [' 1. Congress shall make no law',
  711. \ ' 2.) Congress shall make no law',
  712. \ ' 3.] Congress shall make no law'])
  713. norm! 1gg
  714. redraw!
  715. let lines = s:screen_lines2(1, 6, 20)
  716. let expect = [
  717. \ " 1. Congress ",
  718. \ "shall make no law ",
  719. \ " 2.) Congress ",
  720. \ "shall make no law ",
  721. \ " 3.] Congress ",
  722. \ "shall make no law ",
  723. \ ]
  724. call s:compare_lines(expect, lines)
  725. " set minimum text width
  726. setl briopt=min:5
  727. redraw!
  728. let lines = s:screen_lines2(1, 6, 20)
  729. let expect = [
  730. \ " 1. Congress ",
  731. \ " shall make no law ",
  732. \ " 2.) Congress ",
  733. \ " shall make no law ",
  734. \ " 3.] Congress ",
  735. \ " shall make no law ",
  736. \ ]
  737. call s:compare_lines(expect, lines)
  738. " set additional handing indent
  739. setl briopt+=list:4
  740. redraw!
  741. let expect = [
  742. \ " 1. Congress ",
  743. \ " shall make no ",
  744. \ " law ",
  745. \ " 2.) Congress ",
  746. \ " shall make no ",
  747. \ " law ",
  748. \ " 3.] Congress ",
  749. \ " shall make no ",
  750. \ " law ",
  751. \ ]
  752. let lines = s:screen_lines2(1, 9, 20)
  753. call s:compare_lines(expect, lines)
  754. " reset linebreak option
  755. " Note: it indents by one additional
  756. " space, because of the leading space.
  757. setl linebreak&vim list listchars=eol:$,space:_
  758. redraw!
  759. let expect = [
  760. \ "__1.__Congress_shall",
  761. \ " _make_no_law$ ",
  762. \ "__2.)_Congress_shall",
  763. \ " _make_no_law$ ",
  764. \ "__3.]_Congress_shall",
  765. \ " _make_no_law$ ",
  766. \ ]
  767. let lines = s:screen_lines2(1, 6, 20)
  768. call s:compare_lines(expect, lines)
  769. " check formatlistpat indent
  770. setl briopt=min:5,list:-1
  771. setl linebreak list&vim listchars&vim
  772. let &l:flp = '^\s*\d\+\.\?[\]:)}\t ]\s*'
  773. redraw!
  774. let expect = [
  775. \ " 1. Congress ",
  776. \ " shall make no ",
  777. \ " law ",
  778. \ " 2.) Congress ",
  779. \ " shall make no ",
  780. \ " law ",
  781. \ " 3.] Congress ",
  782. \ " shall make no ",
  783. \ " law ",
  784. \ ]
  785. let lines = s:screen_lines2(1, 9, 20)
  786. call s:compare_lines(expect, lines)
  787. " check with TABs
  788. call setline(1, ["\t1.\tCongress shall make no law",
  789. \ "\t2.) Congress shall make no law",
  790. \ "\t3.] Congress shall make no law"])
  791. setl tabstop=4 list listchars=tab:<->
  792. norm! 1gg
  793. redraw!
  794. let expect = [
  795. \ "<-->1.<>Congress ",
  796. \ " shall make ",
  797. \ " no law ",
  798. \ "<-->2.) Congress ",
  799. \ " shall make ",
  800. \ " no law ",
  801. \ "<-->3.] Congress ",
  802. \ " shall make ",
  803. \ " no law ",
  804. \ ]
  805. let lines = s:screen_lines2(1, 9, 20)
  806. call s:compare_lines(expect, lines)
  807. setl tabstop=2 nolist
  808. redraw!
  809. let expect = [
  810. \ " 1. Congress ",
  811. \ " shall make no ",
  812. \ " law ",
  813. \ " 2.) Congress ",
  814. \ " shall make no ",
  815. \ " law ",
  816. \ " 3.] Congress ",
  817. \ " shall make no ",
  818. \ " law ",
  819. \ ]
  820. let lines = s:screen_lines2(1, 9, 20)
  821. call s:compare_lines(expect, lines)
  822. setl tabstop& list listchars=space:_
  823. redraw!
  824. let expect = [
  825. \ "^I1.^ICongress_ ",
  826. \ " shall_make_no_",
  827. \ " law ",
  828. \ "^I2.)_Congress_ ",
  829. \ " shall_make_no_",
  830. \ " law ",
  831. \ "^I3.]_Congress_ ",
  832. \ " shall_make_no_",
  833. \ " law ",
  834. \ ]
  835. let lines = s:screen_lines2(1, 9, 20)
  836. call s:compare_lines(expect, lines)
  837. " check formatlistpat indent with different list levels
  838. let &l:flp = '^\s*\(\*\|•\)\+\s\+'
  839. setl list&vim listchars&vim
  840. %delete _
  841. call setline(1, ['* Congress shall make no law',
  842. \ '••• Congress shall make no law',
  843. \ '**** Congress shall make no law'])
  844. norm! 1gg
  845. redraw!
  846. let expect = [
  847. \ "* Congress shall ",
  848. \ " make no law ",
  849. \ "••• Congress shall ",
  850. \ " make no law ",
  851. \ "**** Congress shall ",
  852. \ " make no law ",
  853. \ ]
  854. let lines = s:screen_lines2(1, 6, 20)
  855. call s:compare_lines(expect, lines)
  856. " check formatlistpat indent with different list level
  857. " showbreak and sbr
  858. setl briopt=min:5,sbr,list:-1
  859. setl showbreak=>
  860. redraw!
  861. let expect = [
  862. \ "* Congress shall ",
  863. \ "> make no law ",
  864. \ "••• Congress shall ",
  865. \ "> make no law ",
  866. \ "**** Congress shall ",
  867. \ "> make no law ",
  868. \ ]
  869. let lines = s:screen_lines2(1, 6, 20)
  870. call s:compare_lines(expect, lines)
  871. " check formatlistpat indent with different list level
  872. " showbreak sbr and shift
  873. setl briopt=min:5,sbr,list:-1,shift:2
  874. setl showbreak=>
  875. redraw!
  876. let expect = [
  877. \ "* Congress shall ",
  878. \ "> make no law ",
  879. \ "••• Congress shall ",
  880. \ "> make no law ",
  881. \ "**** Congress shall ",
  882. \ "> make no law ",
  883. \ ]
  884. let lines = s:screen_lines2(1, 6, 20)
  885. call s:compare_lines(expect, lines)
  886. " check breakindent works if breakindentopt=list:-1
  887. " for a non list content
  888. %delete _
  889. call setline(1, [' Congress shall make no law',
  890. \ ' Congress shall make no law',
  891. \ ' Congress shall make no law'])
  892. norm! 1gg
  893. setl briopt=min:5,list:-1
  894. setl showbreak=
  895. redraw!
  896. let expect = [
  897. \ " Congress shall ",
  898. \ " make no law ",
  899. \ " Congress shall ",
  900. \ " make no law ",
  901. \ " Congress shall ",
  902. \ " make no law ",
  903. \ ]
  904. let lines = s:screen_lines2(1, 6, 20)
  905. call s:compare_lines(expect, lines)
  906. call s:close_windows('set breakindent& briopt& linebreak& list& listchars& showbreak&')
  907. endfunc
  908. " The following used to crash Vim. This is fixed by 8.2.3391.
  909. " This is a regression introduced by 8.2.2903.
  910. func Test_window_resize_with_linebreak()
  911. new
  912. 53vnew
  913. setl linebreak
  914. setl showbreak=>>
  915. setl breakindent
  916. setl breakindentopt=shift:4
  917. call setline(1, "\naaaaaaaaa\n\na\naaaaa\n¯aaaaaaaaaa\naaaaaaaaaaaa\naaa\n\"a:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - aaaaaaaa\"\naaaaaaaa\n\"a")
  918. redraw!
  919. call assert_equal([" >>aa^@\"a: "], ScreenLines(2, 14))
  920. vertical resize 52
  921. redraw!
  922. call assert_equal([" >>aaa^@\"a:"], ScreenLines(2, 14))
  923. set linebreak& showbreak& breakindent& breakindentopt&
  924. %bw!
  925. endfunc
  926. func Test_cursor_position_with_showbreak()
  927. CheckScreendump
  928. let lines =<< trim END
  929. vim9script
  930. &signcolumn = 'yes'
  931. &showbreak = '++'
  932. &breakindentopt = 'shift:2'
  933. var leftcol: number = win_getid()->getwininfo()->get(0, {})->get('textoff')
  934. repeat('x', &columns - leftcol - 1)->setline(1)
  935. 'second line'->setline(2)
  936. END
  937. call writefile(lines, 'XscriptShowbreak', 'D')
  938. let buf = RunVimInTerminal('-S XscriptShowbreak', #{rows: 6})
  939. call term_sendkeys(buf, "AX")
  940. call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_1', {})
  941. " No line wraps, so changing 'showbreak' should lead to the same screen.
  942. call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal showbreak=+\<CR>")
  943. call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_1', {})
  944. " No line wraps, so setting 'breakindent' should lead to the same screen.
  945. call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal breakindent\<CR>")
  946. call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_1', {})
  947. " The first line now wraps because of "eol" in 'listchars'.
  948. call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal list\<CR>")
  949. call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_2', {})
  950. call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal nobreakindent\<CR>")
  951. call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_3', {})
  952. call StopVimInTerminal(buf)
  953. endfunc
  954. func Test_visual_starts_before_skipcol()
  955. CheckScreendump
  956. let lines =<< trim END
  957. 1new
  958. setlocal breakindent
  959. call setline(1, "\t" .. join(range(100)))
  960. END
  961. call writefile(lines, 'XvisualStartsBeforeSkipcol', 'D')
  962. let buf = RunVimInTerminal('-S XvisualStartsBeforeSkipcol', #{rows: 6})
  963. call term_sendkeys(buf, "v$")
  964. call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_1', {})
  965. call term_sendkeys(buf, "\<Esc>:setlocal showbreak=+++\<CR>gv")
  966. call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_2', {})
  967. call term_sendkeys(buf, "\<Esc>:setlocal breakindentopt+=sbr\<CR>gv")
  968. call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_3', {})
  969. call term_sendkeys(buf, "\<Esc>:setlocal nobreakindent\<CR>gv")
  970. call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_4', {})
  971. call StopVimInTerminal(buf)
  972. endfunc
  973. func Test_no_spurious_match()
  974. let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50))
  975. call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls')
  976. let @/ = '\%>3v[y]'
  977. redraw!
  978. call searchcount().total->assert_equal(1)
  979. " cleanup
  980. set hls&vim
  981. bwipeout!
  982. endfunc
  983. func Test_no_extra_indent()
  984. call s:test_windows('setl breakindent breakindentopt=list:-1,min:10')
  985. %d
  986. let &l:formatlistpat='^\s*\d\+\.\s\+'
  987. let text = 'word '
  988. let len = text->strcharlen()
  989. let line1 = text->repeat((winwidth(0) / len) * 2)
  990. let line2 = repeat(' ', 2) .. '1. ' .. line1
  991. call setline(1, [line2])
  992. redraw!
  993. " 1) matches formatlist pattern, so indent
  994. let expect = [
  995. \ " 1. word word word ",
  996. \ " word word word ",
  997. \ " word word ",
  998. \ "~ ",
  999. \ ]
  1000. let lines = s:screen_lines2(1, 4, 20)
  1001. call s:compare_lines(expect, lines)
  1002. " 2) change formatlist pattern
  1003. " -> indent adjusted
  1004. let &l:formatlistpat='^\s*\d\+\.'
  1005. let expect = [
  1006. \ " 1. word word word ",
  1007. \ " word word word ",
  1008. \ " word word ",
  1009. \ "~ ",
  1010. \ ]
  1011. let lines = s:screen_lines2(1, 4, 20)
  1012. " 3) no local formatlist pattern,
  1013. " so use global one -> indent
  1014. let g_flp = &g:flp
  1015. let &g:formatlistpat='^\s*\d\+\.\s\+'
  1016. let &l:formatlistpat=''
  1017. let expect = [
  1018. \ " 1. word word word ",
  1019. \ " word word word ",
  1020. \ " word word ",
  1021. \ "~ ",
  1022. \ ]
  1023. let lines = s:screen_lines2(1, 4, 20)
  1024. call s:compare_lines(expect, lines)
  1025. let &g:flp = g_flp
  1026. let &l:formatlistpat='^\s*\d\+\.'
  1027. " 4) add something in front, no additional indent
  1028. norm! gg0
  1029. exe ":norm! 5iword \<esc>"
  1030. redraw!
  1031. let expect = [
  1032. \ "word word word word ",
  1033. \ "word 1. word word ",
  1034. \ "word word word word ",
  1035. \ "word word ",
  1036. \ "~ ",
  1037. \ ]
  1038. let lines = s:screen_lines2(1, 5, 20)
  1039. call s:compare_lines(expect, lines)
  1040. bwipeout!
  1041. endfunc
  1042. func Test_breakindent_column()
  1043. call s:test_windows('setl breakindent breakindentopt=column:10')
  1044. redraw!
  1045. " 1) default: does not indent, too wide :(
  1046. let expect = [
  1047. \ " ",
  1048. \ " abcdefghijklmnop",
  1049. \ "qrstuvwxyzABCDEFGHIJ",
  1050. \ "KLMNOP "
  1051. \ ]
  1052. let lines = s:screen_lines2(1, 4, 20)
  1053. call s:compare_lines(expect, lines)
  1054. " 2) lower min value, so that breakindent works
  1055. setl breakindentopt+=min:5
  1056. redraw!
  1057. let expect = [
  1058. \ " ",
  1059. \ " abcdefghijklmnop",
  1060. \ " qrstuvwxyz",
  1061. \ " ABCDEFGHIJ",
  1062. \ " KLMNOP "
  1063. \ ]
  1064. let lines = s:screen_lines2(1, 5, 20)
  1065. " 3) set shift option -> no influence
  1066. setl breakindentopt+=shift:5
  1067. redraw!
  1068. let expect = [
  1069. \ " ",
  1070. \ " abcdefghijklmnop",
  1071. \ " qrstuvwxyz",
  1072. \ " ABCDEFGHIJ",
  1073. \ " KLMNOP "
  1074. \ ]
  1075. let lines = s:screen_lines2(1, 5, 20)
  1076. call s:compare_lines(expect, lines)
  1077. " 4) add showbreak value
  1078. setl showbreak=++
  1079. redraw!
  1080. let expect = [
  1081. \ " ",
  1082. \ " abcdefghijklmnop",
  1083. \ " ++qrstuvwx",
  1084. \ " ++yzABCDEF",
  1085. \ " ++GHIJKLMN",
  1086. \ " ++OP "
  1087. \ ]
  1088. let lines = s:screen_lines2(1, 6, 20)
  1089. call s:compare_lines(expect, lines)
  1090. bwipeout!
  1091. endfunc
  1092. func Test_linebreak_list()
  1093. " This was setting wlv.c_extra to NUL while wlv.p_extra is NULL
  1094. filetype plugin on
  1095. syntax enable
  1096. edit! $VIMRUNTIME/doc/index.txt
  1097. /v_P
  1098. setlocal list
  1099. setlocal listchars=tab:>-
  1100. setlocal linebreak
  1101. setlocal nowrap
  1102. setlocal filetype=help
  1103. redraw!
  1104. bwipe!
  1105. endfunc
  1106. func Test_breakindent_change_display_uhex()
  1107. call s:test_windows('setl briopt=min:0 list listchars=eol:$')
  1108. redraw!
  1109. let lines = s:screen_lines(line('.'), 20)
  1110. let expect = [
  1111. \ "^Iabcdefghijklmnopqr",
  1112. \ " stuvwxyzABCDEFGHIJ",
  1113. \ " KLMNOP$ "
  1114. \ ]
  1115. call s:compare_lines(expect, lines)
  1116. set display+=uhex
  1117. redraw!
  1118. let lines = s:screen_lines(line('.'), 20)
  1119. let expect = [
  1120. \ "<09>abcdefghijklmnop",
  1121. \ " qrstuvwxyzABCDEF",
  1122. \ " GHIJKLMNOP$ "
  1123. \ ]
  1124. call s:compare_lines(expect, lines)
  1125. set display&
  1126. call s:close_windows()
  1127. endfunc
  1128. func Test_breakindent_list_split()
  1129. 10new
  1130. 61vsplit
  1131. setlocal tabstop=8 breakindent list listchars=tab:<->,eol:$
  1132. put =s:input
  1133. 30vsplit
  1134. setlocal listchars=eol:$
  1135. let expect = [
  1136. \ "^IabcdefghijklmnopqrstuvwxyzAB|<------>abcdefghijklmnopqrstuv",
  1137. \ " CDEFGHIJKLMNOP$ | wxyzABCDEFGHIJKLMNOP$ ",
  1138. \ "~ |~ "
  1139. \ ]
  1140. redraw!
  1141. let lines = s:screen_lines(line('.'), 61)
  1142. call s:compare_lines(expect, lines)
  1143. wincmd p
  1144. redraw!
  1145. let lines = s:screen_lines(line('.'), 61)
  1146. call s:compare_lines(expect, lines)
  1147. bwipe!
  1148. endfunc
  1149. func Test_breakindent_min_with_signcol()
  1150. call s:test_windows('setl briopt=min:15 signcolumn=yes')
  1151. redraw!
  1152. let expect = [
  1153. \ " abcdefghijklmn",
  1154. \ " opqrstuvwxyzABC",
  1155. \ " DEFGHIJKLMNOP "
  1156. \ ]
  1157. let lines = s:screen_lines(line('.'), 20)
  1158. call s:compare_lines(expect, lines)
  1159. setl briopt=min:17
  1160. redraw!
  1161. let expect = [
  1162. \ " abcdefghijklmn",
  1163. \ " opqrstuvwxyzABCDE",
  1164. \ " FGHIJKLMNOP "
  1165. \ ]
  1166. let lines = s:screen_lines(line('.'), 20)
  1167. call s:compare_lines(expect, lines)
  1168. setl briopt=min:19
  1169. redraw!
  1170. let expect = [
  1171. \ " abcdefghijklmn",
  1172. \ " opqrstuvwxyzABCDEF",
  1173. \ " GHIJKLMNOP "
  1174. \ ]
  1175. let lines = s:screen_lines(line('.'), 20)
  1176. call s:compare_lines(expect, lines)
  1177. call s:close_windows()
  1178. endfunc
  1179. func Test_breakindent_with_double_width_wrap()
  1180. 50vnew
  1181. setlocal tabstop=8 breakindent nolist
  1182. call setline(1, "\t" .. repeat('a', winwidth(0) - 9) .. '口口口')
  1183. normal! $g0
  1184. call assert_equal(2, winline())
  1185. call assert_equal(9, wincol())
  1186. bwipe!
  1187. endfunc
  1188. " vim: shiftwidth=2 sts=2 expandtab