Lines Matching refs:s
21 let s:cpo_sav = &cpo
22 let s:ls = &ls
23 let s:ei_sav = &eventignore
30 let s:end=line('$')
35 let s:htmlfont = "'". join(g:html_font,"','") . "', monospace"
37 let s:htmlfont = "'". g:html_font . "', monospace"
40 let s:htmlfont = "monospace"
43 let s:settings = tohtml#GetUserSettings()
45 if s:settings.use_xhtml
46 let s:html5 = 0
47 elseif s:settings.use_css && !s:settings.no_pre
48 let s:html5 = 1
50 let s:html5 = 0
53 if !exists('s:FOLDED_ID')
54 let s:FOLDED_ID = hlID("Folded") | lockvar s:FOLDED_ID
55 let s:FOLD_C_ID = hlID("FoldColumn") | lockvar s:FOLD_C_ID
56 let s:LINENR_ID = hlID('LineNr') | lockvar s:LINENR_ID
57 let s:DIFF_D_ID = hlID("DiffDelete") | lockvar s:DIFF_D_ID
58 let s:DIFF_A_ID = hlID("DiffAdd") | lockvar s:DIFF_A_ID
59 let s:DIFF_C_ID = hlID("DiffChange") | lockvar s:DIFF_C_ID
60 let s:DIFF_T_ID = hlID("DiffText") | lockvar s:DIFF_T_ID
61 let s:CONCEAL_ID = hlID('Conceal') | lockvar s:CONCEAL_ID
65 if s:settings.pre_wrap
66 let s:whitespace = "white-space: pre-wrap; "
68 let s:whitespace = ""
71 if !empty(s:settings.prevent_copy)
72 if s:settings.no_invalid
77 let s:unselInputType = ""
81 let s:unselInputType = " type='invalid_input_type'"
89 let s:whatterm = "gui"
91 let s:whatterm = "cterm"
93 let s:cterm_color = {
98 let s:cterm_color = {
107 call extend(s:cterm_color, {
122 call extend(s:cterm_color, {
131 call extend(s:cterm_color, {
146 call extend(s:cterm_color, {
160 call extend(s:cterm_color, {
174 call extend(s:cterm_color, {
188 call extend(s:cterm_color, {
209 if s:whatterm == "gui"
210 function! s:HtmlColor(color)
214 function! s:HtmlColor(color)
215 if has_key(s:cterm_color, a:color)
216 return s:cterm_color[a:color]
224 let s:fgc = s:HtmlColor(synIDattr(hlID("Normal"), "fg#", s:whatterm))
225 let s:bgc = s:HtmlColor(synIDattr(hlID("Normal"), "bg#", s:whatterm))
226 if s:fgc == ""
227 let s:fgc = ( &background == "dark" ? "#ffffff" : "#000000" )
229 if s:bgc == ""
230 let s:bgc = ( &background == "dark" ? "#000000" : "#ffffff" )
233 if !s:settings.use_css
235 function! s:HtmlOpening(id, extra_attrs)
239 let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm))
240 … let a = a . '<span '.a:extra_attrs.'style="background-color: ' . ( x != "" ? x : s:fgc ) . '">'
241 let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm))
242 let a = a . '<font color="' . ( x != "" ? x : s:bgc ) . '">'
244 let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm))
250 let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm))
260 function! s:HtmlClosing(id, has_extra_attrs)
268 let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm))
270 let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm))
285 if s:settings.use_css
290 …\ 'function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselectable, un…
292 \ ' let l:style_name = synIDattr(a:style_id, "name", s:whatterm)'
296 \ ' let l:diff_style_name = synIDattr(a:diff_style_id, "name", s:whatterm)']
305 \ ' if a:style_id == s:DIFF_D_ID || a:style_id == s:DIFF_A_ID ||'.
306 \ ' a:style_id == s:DIFF_C_ID || a:style_id == s:DIFF_T_ID',
307 \ ' let l:saved_style = get(s:diffstylelist,a:style_id)',
314 \ ' let l:saved_style = get(s:stylelist,a:style_id)',
317 \ ' let l:saved_style = s:CSS1(a:style_id)',
321 \ ' let s:stylelist[a:style_id]= l:saved_style',
363 if s:settings.prevent_copy == ""
378 " <input>s have a background color (maybe not really a bug, this isn't
395 if s:settings.use_input_for_pc !=# 'all'
399 if s:settings.use_input_for_pc !=# 'none'
401 \ '<input'.s:unselInputType.' class=\"" . l:style_name .'.diffstyle.'"\"'.
402 \ ' value=\"".substitute(a:unformatted,''\s\+$'',"","")."\"'.
408 \ (s:settings.use_xhtml ? '/' : '').'>'
427 …\ 'function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2…
428 \ ' return s:HtmlOpening(a:style_id, a:extra_attrs).(a:diff_style_id <= 0 ? "" :'.
429 \ 's:HtmlOpening(a:diff_style_id, "")).a:text.'.
430 …\ '(a:diff_style_id <= 0 ? "" : s:HtmlClosing(a:diff_style_id, 0)).s:HtmlClosing(a:style_id, !em…
435 …\ 'function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2…
436 …\ ' return s:HtmlOpening(a:style_id, a:extra_attrs).a:text.s:HtmlClosing(a:style_id, !empty(a:ext…
445 let s:diff_mode = &diff
451 function! s:HtmlFormat(text, style_id, diff_style_id, extra_attrs, make_unselectable)
473 if ' ' != s:HtmlSpace
474 let formatted = substitute(formatted, ' ', s:HtmlSpace . s:HtmlSpace, 'g')
475 let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g')
476 let formatted = substitute(formatted, ' \+$', s:HtmlSpace, 'g')
480 …return s:BuildStyleWrapper(a:style_id, a:diff_style_id, a:extra_attrs, formatted, a:make_unselecta…
485 if s:settings.prevent_copy =~# 'n'
486 if s:settings.number_lines
487 if s:settings.line_ids
488 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
490 …return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? '…
492 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
496 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
497 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
500 elseif s:settings.line_ids
505 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
506 …return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? '…
510 if s:settings.line_ids
511 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
513 …return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? '…
515 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
519 function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
520 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
524 if s:settings.prevent_copy =~# 'd'
525 function! s:HtmlFormat_d(text, style_id, diff_style_id)
526 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
529 function! s:HtmlFormat_d(text, style_id, diff_style_id)
530 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
533 if s:settings.prevent_copy =~# 'f'
534 if s:settings.use_input_for_pc ==# 'none'
537 function! s:FoldColumn_build(char, len, numfill, char2, class, click)
542 function! s:FoldColumn_fill()
543 return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 1)
558 \ 'function! s:FoldColumn_build(char, len, numfill, char2, class, click)',
559 \ ' let l:input_open = "<input readonly=''readonly''".s:unselInputType.'.
566 \ ' let l:input_close = (s:settings.use_xhtml ? "'' />" : "''>")'
568 if s:settings.use_input_for_pc ==# 'fallback'
580 \ (s:settings.use_input_for_pc ==# 'fallback' ? 'l:gen_content_link.' : "").
587 function! s:FoldColumn_fill()
588 return s:FoldColumn_build(' ', s:foldcolumn, 0, '', 'FoldColumn', '')
594 function! s:FoldColumn_build(char, len, numfill, char2, class, click)
599 function! s:FoldColumn_fill()
600 return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 0)
603 if s:settings.prevent_copy =~# 't'
609 if s:settings.dynamic_folds
610 function! s:HtmlFormat_t(text, style_id, diff_style_id)
611 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) .
612 \ s:HtmlFormat("", a:style_id, 0, "", 0)
615 function! s:HtmlFormat_t(text, style_id, diff_style_id)
616 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
620 function! s:HtmlFormat_t(text, style_id, diff_style_id)
621 return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
626 function! s:CSS1(id)
630 let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm))
631 let a = a . "color: " . ( x != "" ? x : s:bgc ) . "; "
632 let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm))
633 let a = a . "background-color: " . ( x != "" ? x : s:fgc ) . "; "
635 let x = s:HtmlColor(synIDattr(a:id, "fg#", s:whatterm))
637 let x = s:HtmlColor(synIDattr(a:id, "bg#", s:whatterm))
643 …elseif (a:id == s:FOLDED_ID || a:id == s:LINENR_ID || a:id == s:FOLD_C_ID) && !empty(s:settings.pr…
645 let a = a . "background-color: " . s:bgc . "; "
654 if s:settings.dynamic_folds
658 function! s:FoldCompare(f1, f2)
677 let s:old_title = &title
678 let s:old_icon = &icon
679 let s:old_et = &l:et
680 let s:old_bind = &l:scrollbind
681 let s:old_report = &report
682 let s:old_search = @/
683 let s:old_more = &more
691 let s:current_syntax = w:current_syntax
693 let s:current_syntax = b:current_syntax
695 let s:current_syntax = 'none'
698 if s:current_syntax == ''
699 let s:current_syntax = 'none'
706 " main plugin file at it's usual spot relative to this file. Otherwise the user
720 let s:pluginversion = g:loaded_2html_plugin
723 let s:main_plugin_path = expand("<sfile>:p:h:h")."/plugin/tohtml.vim"
724 if filereadable(s:main_plugin_path)
725 let s:lines = readfile(s:main_plugin_path, "", 20)
726 call filter(s:lines, 'v:val =~ "loaded_2html_plugin = "')
727 if empty(s:lines)
730 …let g:unloaded_tohtml_plugin = substitute(s:lines[0], '.*loaded_2html_plugin = \([''"]\)\(\%(\1\@!…
732 unlet s:lines
736 unlet s:main_plugin_path
738 let s:pluginversion = g:unloaded_tohtml_plugin
742 let s:orgbufnr = winbufnr(0)
743 let s:origwin_stl = &l:stl
746 exec 'new Untitled_win'.g:html_diff_win_num.'.'.(s:settings.use_xhtml ? 'x' : '').'html'
748 exec 'new Untitled.'.(s:settings.use_xhtml ? 'x' : '').'html'
751 exec 'new %.'.(s:settings.use_xhtml ? 'x' : '').'html'
755 let s:old_winheight = winheight(0)
756 let s:old_winfixheight = &l:winfixheight
757 if s:old_winheight > 2
764 let s:newwin_stl = &l:stl
767 let s:old_fen = &foldenable
771 let s:newwin = winnr()
772 let s:orgwin = bufwinnr(s:orgbufnr)
776 let s:old_paste = &paste
778 let s:old_magic = &magic
782 let &l:fileencoding=s:settings.vim_encoding
788 if s:settings.vim_encoding == 'utf-8'
794 let s:lines = []
796 if s:settings.use_xhtml
797 if s:settings.encoding != ""
798 call add(s:lines, "<?xml version=\"1.0\" encoding=\"" . s:settings.encoding . "\"?>")
800 call add(s:lines, "<?xml version=\"1.0\"?>")
802 let s:tag_close = ' />'
804 let s:tag_close = '>'
807 let s:HtmlSpace = ' '
808 let s:LeadingSpace = ' '
809 let s:HtmlEndline = ''
810 if s:settings.no_pre
811 let s:HtmlEndline = '<br' . s:tag_close
812 let s:LeadingSpace = s:settings.use_xhtml ? ' ' : ' '
813 let s:HtmlSpace = '\' . s:LeadingSpace
818 call extend(s:lines, [
823 if s:settings.encoding != "" && !s:settings.use_xhtml
824 if s:html5
825 call add(s:lines, '<meta charset="' . s:settings.encoding . '"' . s:tag_close)
827 …call add(s:lines, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.e…
830 call extend(s:lines, [
832 \ ("<meta name=\"Generator\" content=\"Vim/".v:version/100.".".v:version%100.'"'.s:tag_close),
833 \ ("<meta name=\"plugin-version\" content=\"".s:pluginversion.'"'.s:tag_close)
835 call add(s:lines, '<meta name="syntax" content="'.s:current_syntax.'"'.s:tag_close)
836 call add(s:lines, '<meta name="settings" content="'.
837 \ join(filter(keys(s:settings),'s:settings[v:val]'),',').
838 \ ',prevent_copy='.s:settings.prevent_copy.
839 \ ',use_input_for_pc='.s:settings.use_input_for_pc.
840 \ '"'.s:tag_close)
841 call add(s:lines, '<meta name="colorscheme" content="'.
844 \ : 'none'). '"'.s:tag_close)
846 if s:settings.use_css
847 call extend(s:lines, [
848 \ "<style" . (s:html5 ? "" : " type=\"text/css\"") . ">",
849 \ s:settings.use_xhtml ? "" : "<!--"])
850 let s:ieonly = []
851 if s:settings.dynamic_folds
852 if s:settings.hover_unfold
854 call extend(s:lines, [
877 let s:ieonly = [
893 call extend(s:lines, [
909 call extend(s:lines, [
910 \ s:settings.use_xhtml ? "" : '-->',
913 call extend(s:lines, s:ieonly)
914 unlet s:ieonly
917 let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids
920 if s:uses_script
921 call extend(s:lines, [
923 \ "<script" . (s:html5 ? "" : " type='text/javascript'") . ">",
924 \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
928 if s:settings.dynamic_folds
929 call extend(s:lines, [
947 if s:settings.line_ids
950 call extend(s:lines, [
965 if s:settings.dynamic_folds
966 call extend(s:lines, [
970 \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')",
980 call extend(s:lines, [
996 if s:uses_script
997 call extend(s:lines, [
999 \ s:settings.use_xhtml ? '//]]>' : '-->',
1004 call extend(s:lines, ["</head>",
1005 \ "<body".(s:settings.line_ids ? " onload='JumpToLine();'" : "").">"])
1007 if s:settings.no_pre
1009 if s:settings.use_css
1010 call extend(s:lines, ["<div id='vimCodeElement".s:settings.id_suffix."'>"])
1013 call extend(s:lines, ["<pre id='vimCodeElement".s:settings.id_suffix."'>"])
1016 exe s:orgwin . "wincmd w"
1020 if s:settings.number_lines
1021 let s:stylelist = { s:LINENR_ID : ".LineNr { " . s:CSS1( s:LINENR_ID ) . "}" }
1023 let s:stylelist = {}
1025 let s:diffstylelist = {
1026 \ s:DIFF_A_ID : ".DiffAdd { " . s:CSS1( s:DIFF_A_ID ) . "}",
1027 \ s:DIFF_C_ID : ".DiffChange { " . s:CSS1( s:DIFF_C_ID ) . "}",
1028 \ s:DIFF_D_ID : ".DiffDelete { " . s:CSS1( s:DIFF_D_ID ) . "}",
1029 \ s:DIFF_T_ID : ".DiffText { " . s:CSS1( s:DIFF_T_ID ) . "}"
1033 if !s:settings.no_progress
1035 let s:progressbar={}
1039 func! s:SetProgbarColor()
1043 \ !exists("s:last_colors_name") || !exists("g:colors_name") ||
1044 \ g:colors_name != s:last_colors_name
1045 let s:last_colors_name = exists("g:colors_name") ? g:colors_name : "none"
1047 let l:diffatr = synIDattr(hlID("DiffDelete"), "reverse", s:whatterm) ? "fg#" : "bg#"
1048 let l:stlatr = synIDattr(hlID("StatusLine"), "reverse", s:whatterm) ? "fg#" : "bg#"
1050 let l:progbar_color = synIDattr(hlID("DiffDelete"), l:diffatr, s:whatterm)
1051 let l:stl_color = synIDattr(hlID("StatusLine"), l:stlatr, s:whatterm)
1054 let l:progbar_color = synIDattr(hlID("DiffDelete"), "reverse", s:whatterm) ? s:fgc : s:bgc
1057 let l:stl_color = synIDattr(hlID("StatusLine"), "reverse", s:whatterm) ? s:fgc : s:bgc
1061 if s:whatterm == 'cterm'
1087 exe "hi TOhtmlProgress_auto" s:whatterm."bg=".l:progbar_color
1091 func! s:ProgressBar(title, max_value, winnr)
1092 let pgb=copy(s:progressbar)
1117 func! s:progressbar.calculate_ticks(pb_len)
1127 func! s:progressbar.paint()
1178 func! s:progressbar.incr( ... )
1187 if s:settings.dynamic_folds
1189 let s:pgb = s:ProgressBar("Processing folds:", line('$')*2, s:orgwin)
1192 call s:SetProgbarColor()
1197 let s:allfolds = []
1199 if s:settings.dynamic_folds
1200 let s:lnum = 1
1201 let s:end = line('$')
1203 let s:foldtext_save = &foldtext
1208 let s:foldcolumn = &foldcolumn
1211 while s:lnum <= s:end
1212 if foldclosed(s:lnum) == s:lnum
1216 let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
1218 …let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': …
1219 call add(s:allfolds, s:newfold)
1221 execute s:lnum."foldopen"
1223 if !s:settings.no_progress
1224 call s:pgb.incr()
1225 if s:pgb.needs_redraw
1227 let s:pgb.needs_redraw = 0
1230 let s:lnum = s:lnum + 1
1236 let s:lnum = 1
1240 while s:lnum <= s:end
1241 if foldclosed(s:lnum) == s:lnum
1245 let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
1246 …let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': …
1248 if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
1249 let s:newfold.type = "open-fold"
1250 call add(s:allfolds, s:newfold)
1253 execute s:lnum."foldopen"
1255 if !s:settings.no_progress
1256 call s:pgb.incr()
1257 if s:pgb.needs_redraw
1259 let s:pgb.needs_redraw = 0
1262 let s:lnum = s:lnum + 1
1268 call sort(s:allfolds, "s:FoldCompare")
1270 let &l:foldtext = s:foldtext_save
1271 unlet s:foldtext_save
1287 for afold in s:allfolds
1299 call remove(s:allfolds, index(s:allfolds, afold))
1307 call remove(s:allfolds, index(s:allfolds, afold))
1321 call remove(s:allfolds, index(s:allfolds, afold))
1327 if afold.level+1 > s:foldcolumn
1328 let s:foldcolumn = afold.level+1
1348 let s:lnum = html_start_line
1349 if s:lnum < 1 || s:lnum > line("$")
1350 let s:lnum = 1
1353 let s:lnum = 1
1356 let s:end = html_end_line
1357 if s:end < s:lnum || s:end > line("$")
1358 let s:end = line("$")
1361 let s:end = line("$")
1365 let s:foldstack = []
1367 if !s:settings.no_progress
1368 let s:pgb = s:ProgressBar("Processing lines:", s:end - s:lnum + 1, s:orgwin)
1371 if s:settings.number_lines
1372 let s:margin = strlen(s:end) + 1
1374 let s:margin = 0
1377 if has('folding') && !s:settings.ignore_folding
1378 let s:foldfillchar = &fillchars[matchend(&fillchars, 'fold:')]
1379 if s:foldfillchar == ''
1380 let s:foldfillchar = '-'
1383 let s:difffillchar = &fillchars[matchend(&fillchars, 'diff:')]
1384 if s:difffillchar == ''
1385 let s:difffillchar = '-'
1388 let s:foldId = 0
1390 if !s:settings.expand_tabs
1393 let s:old_isprint = &isprint
1397 while s:lnum <= s:end
1400 let s:filler = diff_filler(s:lnum)
1401 if s:filler > 0
1402 let s:n = s:filler
1403 while s:n > 0
1404 let s:new = repeat(s:difffillchar, 3)
1406 if s:n > 2 && s:n < s:filler && !s:settings.whole_filler
1407 let s:new = s:new . " " . s:filler . " inserted lines "
1408 let s:n = 2
1411 if !s:settings.no_pre
1414 let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new) - s:margin)
1416 let s:new = s:new . repeat(s:difffillchar, 3)
1419 let s:new = s:HtmlFormat_d(s:new, s:DIFF_D_ID, 0)
1420 if s:settings.number_lines
1423 let s:new = s:HtmlFormat_n(repeat(' ', s:margin), s:LINENR_ID, 0, 0) . s:new
1425 if s:settings.dynamic_folds && !s:settings.no_foldcolumn && s:foldcolumn > 0
1426 " Indent for foldcolumn if there is one. Assume it's empty, there should
1428 let s:new = s:FoldColumn_fill() . s:new
1430 call add(s:lines, s:new.s:HtmlEndline)
1432 let s:n = s:n - 1
1434 unlet s:n
1436 unlet s:filler
1439 if s:settings.number_lines
1440 let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) . s:lnum . ' '
1443 let s:new = ""
1445 …if has('folding') && !s:settings.ignore_folding && foldclosed(s:lnum) > -1 && !s:settings.dynamic_…
1448 let s:new = foldtextresult(s:lnum)
1449 if !s:settings.no_pre
1451 let s:new = s:new . repeat(s:foldfillchar, &columns - strlen(s:new))
1455 …let s:new = (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, s:lnum): "") . s:H…
1458 let s:new_lnum = foldclosedend(s:lnum)
1460 if !s:settings.no_progress
1461 call s:pgb.incr(s:new_lnum - s:lnum)
1464 let s:lnum = s:new_lnum
1470 let s:line = getline(s:lnum)
1471 let s:len = strlen(s:line)
1473 if s:settings.dynamic_folds
1475 while !empty(s:foldstack) && get(s:foldstack,0).lastline == s:lnum-1
1476 let s:new = s:new."</span></span>"
1477 call remove(s:foldstack, 0)
1481 let s:firstfold = 1
1482 while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
1483 let s:foldId = s:foldId + 1
1484 let s:new .= "<span id='"
1485 let s:new .= (exists('g:html_diff_win_num') ? "win".g:html_diff_win_num : "")
1486 let s:new .= "fold".s:foldId.s:settings.id_suffix."' class='".s:allfolds[0].type."'>"
1494 if !s:settings.no_foldcolumn
1496 if s:allfolds[0].level > 1 && s:firstfold
1497 let s:new = s:new . s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
1498 …\ 'toggle-open FoldColumn','javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'"…
1502 let s:new = s:new . s:FoldColumn_build("+", 1, 0, "",
1503 \ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
1508 let s:new = s:new . s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
1509 …\ 'toggle-open FoldColumn'. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-fi…
1510 \ 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
1515 if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
1516 let s:extra_space = s:foldcolumn - s:allfolds[0].level
1518 let s:extra_space = 0
1520 if s:firstfold
1523 let s:new .= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
1524 \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
1527 let s:new = s:new . s:FoldColumn_build("-", 1, s:extra_space, "",
1528 \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
1530 let s:firstfold = 0
1536 …s:new = s:new . (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, 0) : "") . sub…
1537 let s:new = s:new . "<span class='fulltext'>"
1541 execute s:lnum."foldopen"
1542 call insert(s:foldstack, remove(s:allfolds,0))
1543 let s:foldstack[0].id = s:foldId
1551 if !s:settings.no_foldcolumn
1552 if empty(s:foldstack)
1555 if s:foldcolumn > 0
1556 let s:new = s:new . s:FoldColumn_fill()
1560 if get(s:foldstack, 0).firstline < s:lnum
1561 …let s:new = s:new . s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].le…
1562 \ 'FoldColumn', 'javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'");')
1569 if s:settings.number_lines
1570 let s:new = s:new . s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
1571 elseif s:settings.line_ids
1572 let s:new = s:new . s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
1576 let s:diffattr = diff_hlID(s:lnum, 1)
1579 let s:concealinfo = [0, '']
1582 let s:col = 1
1585 let s:diff_id = 0
1587 while s:col <= s:len || (s:col == 1 && s:diffattr)
1588 let s:startcol = s:col " The start column for processing text
1589 if !s:settings.ignore_conceal && has('conceal')
1590 let s:concealinfo = synconcealed(s:lnum, s:col)
1592 if !s:settings.ignore_conceal && s:concealinfo[0]
1593 let s:col = s:col + 1
1594 " Speed loop (it's small - that's the trick)
1598 …while s:col <= s:len && s:concealinfo == synconcealed(s:lnum, s:col) | let s:col = s:col + 1 | end…
1599 elseif s:diffattr
1600 let s:diff_id = diff_hlID(s:lnum, s:col)
1601 let s:id = synID(s:lnum, s:col, 1)
1602 let s:col = s:col + 1
1603 " Speed loop (it's small - that's the trick)
1605 while s:col <= s:len && s:id == synID(s:lnum, s:col, 1)
1606 \ && s:diff_id == diff_hlID(s:lnum, s:col) |
1607 \ let s:col = s:col + 1 |
1609 if s:len < &columns && !s:settings.no_pre
1612 let s:line = s:line . repeat(' ', &columns - virtcol([s:lnum, s:len]) - s:margin)
1613 let s:len = &columns
1616 let s:id = synID(s:lnum, s:col, 1)
1617 let s:col = s:col + 1
1618 " Speed loop (it's small - that's the trick)
1620 while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile
1623 if s:settings.ignore_conceal || !s:concealinfo[0]
1625 let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
1626 if s:settings.expand_tabs
1627 let s:offset = 0
1628 let s:idx = stridx(s:expandedtab, "\t")
1629 let s:tablist = split(&vts,',')
1630 if empty(s:tablist)
1631 let s:tablist = [ &ts ]
1633 let s:tabidx = 0
1634 let s:tabwidth = 0
1635 while s:idx >= 0
1636 if s:startcol + s:idx == 1
1637 let s:i = s:tablist[0]
1646 if s:idx == 0
1650 let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:offset) . 'c')
1652 " Otherwise, the byte index of the tab into s:expandedtab is
1653 " given by s:idx.
1654 let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c')
1656 let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
1661 while s:vcol >= s:tabwidth + s:tablist[s:tabidx]
1662 let s:tabwidth += s:tablist[s:tabidx]
1663 if s:tabidx < len(s:tablist)-1
1664 let s:tabidx = s:tabidx+1
1667 let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth)
1670 " actual tab characters instead of replaced spaces; s:idx reflects
1671 " replaced spaces in s:expandedtab, s:offset cancels out all but
1673 let s:offset -= s:i - 1
1674 let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
1675 let s:idx = stridx(s:expandedtab, "\t")
1680 let s:id = synIDtrans(s:id)
1683 let s:id = s:CONCEAL_ID
1684 let s:expandedtab = s:concealinfo[1]
1689 if strlen(s:expandedtab) > 0
1690 let s:new = s:new . s:HtmlFormat(s:expandedtab, s:id, s:diff_id, "", 0)
1695 call extend(s:lines, split(s:new.s:HtmlEndline, '\n', 1))
1696 if !s:settings.no_progress && s:pgb.needs_redraw
1698 let s:pgb.needs_redraw = 0
1700 let s:lnum = s:lnum + 1
1702 if !s:settings.no_progress
1703 call s:pgb.incr()
1707 if s:settings.dynamic_folds
1709 while !empty(s:foldstack)
1710 let s:lines[-1].="</span></span>"
1711 call remove(s:foldstack, 0)
1715 let s:id = s:FOLD_C_ID
1716 if !has_key(s:stylelist, s:id)
1717 let s:stylelist[s:id] = '.FoldColumn { ' . s:CSS1(s:id) . '}'
1721 if s:settings.no_pre
1722 if !s:settings.use_css
1724 call extend(s:lines, ["</font>", "</body>", "</html>"])
1726 call extend(s:lines, ["</div>", "</body>", "</html>"])
1729 call extend(s:lines, ["</pre>", "</body>", "</html>"])
1732 exe s:newwin . "wincmd w"
1733 call setline(1, s:lines)
1734 unlet s:lines
1740 %s!\v(%(^|\s+)%([Vv]i%(m%([<=>]?\d+)?)?|ex)):!\1\:!ge
1748 if s:settings.use_css
1753 if s:settings.use_css
1754 if s:settings.no_pre
1755 …call append('.', "body { color: " . s:fgc . "; background-color: " . s:bgc . "; font-family: ". s:…
1758 …call append('.', "pre { " . s:whitespace . "font-family: ". s:htmlfont ."; color: " . s:fgc . "; b…
1764 if s:whitespace != ''
1765 exec 's#'.s:whitespace
1774 if !empty(s:settings.prevent_copy)
1775 if s:settings.use_input_for_pc !=# "none"
1776 … call append('.', 'input { border: none; margin: 0; padding: 0; font-family: '.s:htmlfont.'; }')
1788 if s:settings.use_input_for_pc !=# 'all'
1789 let s:unselectable_styles = []
1790 if s:settings.prevent_copy =~# 'f'
1791 call add(s:unselectable_styles, 'FoldColumn')
1793 if s:settings.prevent_copy =~# 'n'
1794 call add(s:unselectable_styles, 'LineNr')
1796 if s:settings.prevent_copy =~# 't' && !s:settings.ignore_folding
1797 call add(s:unselectable_styles, 'Folded')
1799 if s:settings.prevent_copy =~# 'd'
1800 call add(s:unselectable_styles, 'DiffDelete')
1802 if s:settings.use_input_for_pc !=# 'none'
1815 if s:settings.prevent_copy =~# 'n' && !s:settings.ignore_folding
1824 for s:style_name in s:unselectable_styles
1826 \ ' .'.s:style_name.' { user-select: none; }',
1827 … \ ' [data-'.s:style_name.'-content]::before { content: attr(data-'.s:style_name.'-content); }',
1828 …\ ' [data-'.s:style_name.'-content]::before { padding-bottom: 1px; display: inline-block; /* matc…
1829 \ ' span[data-'.s:style_name.'-content]::before { cursor: default; }',
1833 if s:settings.use_input_for_pc !=# 'none'
1840 unlet s:unselectable_styles
1844 if s:settings.use_input_for_pc !=# 'none'
1845 if s:settings.prevent_copy =~# 'f'
1849 \ 'input.FoldColumn[value="'.repeat(' ', s:foldcolumn).'"] { cursor: default; }'
1852 if s:settings.use_input_for_pc !=# 'all'
1854 \ 'a[data-FoldColumn-content="'.repeat(' ', s:foldcolumn).'"] { cursor: default; }'
1860 if s:settings.prevent_copy =~# 'n'
1866 …if (s:settings.prevent_copy =~# 'n' || s:settings.prevent_copy =~# 't') && !s:settings.ignore_fold…
1871 if s:settings.prevent_copy =~# 'd'
1878 " For Netscape 4, set <body> attributes too, though, strictly speaking, it's
1880 …execute '%s:<body\([^>]*\):<body bgcolor="' . s:bgc . '" text="' . s:fgc . '"\1>\r<font face="'. s…
1885 if s:settings.use_css
1886 if s:diff_mode
1887 call append('.', filter(map(keys(s:diffstylelist), "s:diffstylelist[v:val]"), 'v:val != ""'))
1889 if !empty(s:stylelist)
1890 call append('.', filter(map(keys(s:stylelist), "s:stylelist[v:val]"), 'v:val != ""'))
1897 %s+\(https\=://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|>\|<\|"\)+<a href="\1">\1</a>…
1900 if s:settings.use_xhtml
1902 elseif s:html5
1908 if s:settings.use_xhtml
1913 %s:\s\+$::e
1919 let &l:foldenable = s:old_fen
1920 let &report = s:old_report
1921 let &title = s:old_title
1922 let &icon = s:old_icon
1923 let &paste = s:old_paste
1924 let &magic = s:old_magic
1925 let @/ = s:old_search
1926 let &more = s:old_more
1929 exe s:orgwin . "wincmd w"
1931 if !s:settings.expand_tabs
1932 let &l:isprint = s:old_isprint
1934 let &l:stl = s:origwin_stl
1935 let &l:et = s:old_et
1936 let &l:scrollbind = s:old_bind
1939 exe s:newwin . "wincmd w"
1941 let &l:stl = s:newwin_stl
1942 exec 'resize' s:old_winheight
1943 let &l:winfixheight = s:old_winfixheight
1945 let &ls=s:ls
1946 let &eventignore=s:ei_sav
1949 unlet s:htmlfont s:whitespace
1950 unlet s:old_et s:old_paste s:old_icon s:old_report s:old_title s:old_search
1951 unlet s:old_magic s:old_more s:old_fen s:old_winheight
1952 unlet! s:old_isprint
1953 unlet s:whatterm s:stylelist s:diffstylelist s:lnum s:end s:margin s:fgc s:bgc s:old_winfixheight
1954 unlet! s:col s:id s:attr s:len s:line s:new s:expandedtab s:concealinfo s:diff_mode
1955 unlet! s:orgwin s:newwin s:orgbufnr s:idx s:i s:offset s:ls s:ei_sav s:origwin_stl
1956 unlet! s:newwin_stl s:current_syntax
1958 delfunc s:HtmlColor
1959 delfunc s:HtmlFormat
1960 delfunc s:CSS1
1961 delfunc s:BuildStyleWrapper
1962 if !s:settings.use_css
1963 delfunc s:HtmlOpening
1964 delfunc s:HtmlClosing
1966 if s:settings.dynamic_folds
1967 delfunc s:FoldCompare
1970 if !s:settings.no_progress
1971 delfunc s:ProgressBar
1972 delfunc s:progressbar.paint
1973 delfunc s:progressbar.incr
1974 unlet s:pgb s:progressbar
1978 unlet! s:new_lnum s:diffattr s:difffillchar s:foldfillchar s:HtmlSpace
1979 unlet! s:LeadingSpace s:HtmlEndline s:firstfold s:numcol s:foldcolumn
1980 unlet s:foldstack s:allfolds s:foldId s:settings
1982 let &cpo = s:cpo_sav
1983 unlet! s:cpo_sav