')
+ call add(html, ' ')
elseif s:settings.use_xhtml
call add(html, ' ')
else
@@ -515,7 +514,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
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_list) "{{{
" 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_list) "{{{
\ ])
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_list) "{{{
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, [
- \ " |