comparison src/testdir/test_highlight.vim @ 34136:36843e079f64 v9.1.0030

patch 9.1.0030: Cannot use terminal alternate font Commit: https://github.com/vim/vim/commit/a606f3ac036e5f3dc313f620e6b4bc00812314f9 Author: PMunch <peterme@peterme.net> Date: Wed Nov 15 15:35:49 2023 +0100 patch 9.1.0030: Cannot use terminal alternate font Problem: Cannot use terminal alternate fonts (PMunch) Solution: Support terminal alternate fonts using CSI SGR 10-20 and t_CF code (PMunch) Add support for alternate font highlighting This adds support for alternate font highlighting using CSI SGR 10-20. Few terminals currently support this, but with added tool support this should improve over time. The change here is more or less taken from how colors are configured and applied, but there might be some parts I missed while implementing it. Changing fonts is done through the new `:hi ctermfont` attribute which takes a number, 0 is the normal font, and the numbers 1-9 select an "alternative" font. Which fonts are in use is up to the terminal. fixes: #13513 closes: #13537 Signed-off-by: PMunch <peterme@peterme.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 15 Jan 2024 22:30:03 +0100
parents def9fc5c92d1
children f5ac23c97a9e
comparison
equal deleted inserted replaced
34135:65a3e7bb12b7 34136:36843e079f64
884 call assert_notmatch('ctermul=', HighlightArgs('Normal')) 884 call assert_notmatch('ctermul=', HighlightArgs('Normal'))
885 highlight Normal ctermul=3 885 highlight Normal ctermul=3
886 call assert_match('ctermul=3', HighlightArgs('Normal')) 886 call assert_match('ctermul=3', HighlightArgs('Normal'))
887 call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul')) 887 call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul'))
888 highlight Normal ctermul=NONE 888 highlight Normal ctermul=NONE
889 endfunc
890
891 " Test for 'ctermfont' in a highlight group
892 func Test_highlight_ctermfont()
893 CheckNotGui
894 call assert_notmatch('ctermfont=', HighlightArgs('Normal'))
895 highlight Normal ctermfont=3
896 call assert_match('ctermfont=3', HighlightArgs('Normal'))
897 call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'font'))
898 highlight Normal ctermfont=NONE
889 endfunc 899 endfunc
890 900
891 " Test for specifying 'start' and 'stop' in a highlight group 901 " Test for specifying 'start' and 'stop' in a highlight group
892 func Test_highlight_start_stop() 902 func Test_highlight_start_stop()
893 hi HlGrp1 start=<Esc>[27h;<Esc>[<Space>r; 903 hi HlGrp1 start=<Esc>[27h;<Esc>[<Space>r;
1312 " Test for empty values of attributes 1322 " Test for empty values of attributes
1313 call hlset([{'name': 'hlg11', 'cterm': {}}]) 1323 call hlset([{'name': 'hlg11', 'cterm': {}}])
1314 call hlset([{'name': 'hlg11', 'ctermfg': ''}]) 1324 call hlset([{'name': 'hlg11', 'ctermfg': ''}])
1315 call hlset([{'name': 'hlg11', 'ctermbg': ''}]) 1325 call hlset([{'name': 'hlg11', 'ctermbg': ''}])
1316 call hlset([{'name': 'hlg11', 'ctermul': ''}]) 1326 call hlset([{'name': 'hlg11', 'ctermul': ''}])
1327 call hlset([{'name': 'hlg11', 'ctermfont': ''}])
1317 call hlset([{'name': 'hlg11', 'font': ''}]) 1328 call hlset([{'name': 'hlg11', 'font': ''}])
1318 call hlset([{'name': 'hlg11', 'gui': {}}]) 1329 call hlset([{'name': 'hlg11', 'gui': {}}])
1319 call hlset([{'name': 'hlg11', 'guifg': ''}]) 1330 call hlset([{'name': 'hlg11', 'guifg': ''}])
1320 call hlset([{'name': 'hlg11', 'guibg': ''}]) 1331 call hlset([{'name': 'hlg11', 'guibg': ''}])
1321 call hlset([{'name': 'hlg11', 'guisp': ''}]) 1332 call hlset([{'name': 'hlg11', 'guisp': ''}])