# HG changeset patch # User Bram Moolenaar # Date 1574002805 -3600 # Node ID cb3163d590a1852cc0a399e1e876ea146c3e02b0 # Parent 453f4942f6cf7445d83615f84fa6527647088ed7 Update runtime files. Commit: https://github.com/vim/vim/commit/09c6f265b21065ffa9437837b1d0955137175e45 Author: Bram Moolenaar Date: Sun Nov 17 15:55:14 2019 +0100 Update runtime files. diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz -" Last Change: 2018 Nov 11 +" Last Change: 2019 Aug 16 " " Additional contributors: " @@ -364,6 +364,7 @@ func! tohtml#Diff2HTML(win_list, buf_lis let body_line = '' let html = [] + let s:html5 = 0 if s:settings.use_xhtml call add(html, xml_line) endif @@ -371,8 +372,9 @@ func! tohtml#Diff2HTML(win_list, buf_lis call add(html, "") call add(html, '') elseif s:settings.use_css && !s:settings.no_pre - call add(html, "") + call add(html, "") call add(html, '') + let s:html5 = 1 else call add(html, '') @@ -383,7 +385,11 @@ func! tohtml#Diff2HTML(win_list, buf_lis " include encoding as close to the top as possible, but only if not already " contained in XML information if s:settings.encoding != "" && !s:settings.use_xhtml - call add(html, "diff') @@ -392,6 +398,7 @@ func! tohtml#Diff2HTML(win_list, buf_lis call add(html, '") - call add(html, "") - call add(html, "
0
") - call add(html, "
") - call add(html, "
") - else - call add(html, '') - endif - call add(html, "") + call add(html, '') + call add(html, "
") call add(html, '') for buf in a:win_list @@ -443,7 +442,7 @@ func! tohtml#Diff2HTML(win_list, buf_lis " Grab the style information. Some of this will be duplicated so only insert " it if it's not already there. {{{ 1 - let style_start = search('^') if style_start > 0 && style_end > 0 @@ -481,7 +480,7 @@ func! tohtml#Diff2HTML(win_list, buf_lis " TODO: restore using grabbed lines if undolevel is 1? normal! 2u if s:settings.use_css - call add(html, '
') + call add(html, '
') elseif s:settings.use_xhtml call add(html, '
') else @@ -515,7 +514,13 @@ func! tohtml#Diff2HTML(win_list, buf_lis let name = substitute(name, '\d*\.x\?html$', '', '') . i . '.' . fnamemodify(copy(name), ":t:e") let i += 1 endwhile + + let s:ei_sav = &eventignore + set eventignore+=FileType exe "topleft new " . name + let &eventignore=s:ei_sav + unlet s:ei_sav + setlocal modifiable " just in case some user autocmd creates content in the new buffer, make sure @@ -544,7 +549,7 @@ func! tohtml#Diff2HTML(win_list, buf_lis " add required javascript in reverse order so we can just call append again " and again without adjusting {{{ - let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy) + let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids " insert script closing tag if needed if s:uses_script @@ -555,31 +560,6 @@ func! tohtml#Diff2HTML(win_list, buf_lis \ ]) endif - " insert script which corrects the size of small input elements in - " prevent_copy mode. See 2html.vim for details on why this is needed and how - " it works. - if !empty(s:settings.prevent_copy) - call append(style_start, [ - \ '', - \ '/* simulate a "ch" unit by asking the browser how big a zero character is */', - \ 'function FixCharWidth() {', - \ ' /* get the hidden element which gives the width of a single character */', - \ ' var goodWidth = document.getElementById("oneCharWidth").clientWidth;', - \ ' /* get all input elements, we''ll filter on class later */', - \ ' var inputTags = document.getElementsByTagName("input");', - \ ' var ratio = 5;', - \ ' var inputWidth = document.getElementById("oneInputWidth").clientWidth;', - \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', - \ ' if (inputWidth > goodWidth) {', - \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', - \ ' ratio += 5;', - \ ' }', - \ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;', - \ ' }', - \ '}' - \ ]) - endif - " insert javascript to get IDs from line numbers, and to open a fold before " jumping to any lines contained therein if s:settings.line_ids @@ -659,10 +639,9 @@ func! tohtml#Diff2HTML(win_list, buf_lis endif if s:uses_script - " insert script tag; javascript is always needed for the line number - " normalization for URL hashes + " insert script tag if needed call append(style_start, [ - \ "