Skip to content

Commit 09c6f26

Browse files
committed
Update runtime files.
1 parent 0324f9e commit 09c6f26

22 files changed

Lines changed: 2457 additions & 2221 deletions

runtime/autoload/tohtml.vim

Lines changed: 52 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim autoload file for the tohtml plugin.
22
" Maintainer: Ben Fritz <[email protected]>
3-
" Last Change: 2018 Nov 11
3+
" Last Change: 2019 Aug 16
44
"
55
" Additional contributors:
66
"
@@ -364,15 +364,17 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
364364
let body_line = ''
365365

366366
let html = []
367+
let s:html5 = 0
367368
if s:settings.use_xhtml
368369
call add(html, xml_line)
369370
endif
370371
if s:settings.use_xhtml
371372
call add(html, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
372373
call add(html, '<html xmlns="http://www.w3.org/1999/xhtml">')
373374
elseif s:settings.use_css && !s:settings.no_pre
374-
call add(html, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">")
375+
call add(html, "<!DOCTYPE html>")
375376
call add(html, '<html>')
377+
let s:html5 = 1
376378
else
377379
call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"')
378380
call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">')
@@ -383,7 +385,11 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
383385
" include encoding as close to the top as possible, but only if not already
384386
" contained in XML information
385387
if s:settings.encoding != "" && !s:settings.use_xhtml
386-
call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . tag_close)
388+
if s:html5
389+
call add(html, '<meta charset="' . s:settings.encoding . '"' . tag_close)
390+
else
391+
call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . tag_close)
392+
endif
387393
endif
388394

389395
call add(html, '<title>diff</title>')
@@ -392,6 +398,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
392398
call add(html, '<meta name="settings" content="'.
393399
\ join(filter(keys(s:settings),'s:settings[v:val]'),',').
394400
\ ',prevent_copy='.s:settings.prevent_copy.
401+
\ ',use_input_for_pc='.s:settings.use_input_for_pc.
395402
\ '"'.tag_close)
396403
call add(html, '<meta name="colorscheme" content="'.
397404
\ (exists('g:colors_name')
@@ -400,16 +407,8 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
400407

401408
call add(html, '</head>')
402409
let body_line_num = len(html)
403-
if !empty(s:settings.prevent_copy)
404-
call add(html, "<body onload='FixCharWidth();".(s:settings.line_ids ? " JumpToLine();" : "")."'>")
405-
call add(html, "<!-- hidden divs used by javascript to get the width of a char -->")
406-
call add(html, "<div id='oneCharWidth'>0</div>")
407-
call add(html, "<div id='oneInputWidth'><input size='1' value='0'".tag_close."</div>")
408-
call add(html, "<div id='oneEmWidth' style='width: 1em;'></div>")
409-
else
410-
call add(html, '<body'.(s:settings.line_ids ? ' onload="JumpToLine();"' : '').'>')
411-
endif
412-
call add(html, "<table border='1' width='100%' id='vimCodeElement".s:settings.id_suffix."'>")
410+
call add(html, '<body'.(s:settings.line_ids ? ' onload="JumpToLine();"' : '').'>')
411+
call add(html, "<table ".(s:settings.use_css? "" : "border='1' width='100%' ")."id='vimCodeElement".s:settings.id_suffix."'>")
413412

414413
call add(html, '<tr>')
415414
for buf in a:win_list
@@ -443,7 +442,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
443442
" Grab the style information. Some of this will be duplicated so only insert
444443
" it if it's not already there. {{{
445444
1
446-
let style_start = search('^<style type="text/css">')
445+
let style_start = search('^<style\( type="text/css"\)\?>')
447446
1
448447
let style_end = search('^</style>')
449448
if style_start > 0 && style_end > 0
@@ -481,7 +480,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
481480
" TODO: restore using grabbed lines if undolevel is 1?
482481
normal! 2u
483482
if s:settings.use_css
484-
call add(html, '<td valign="top"><div>')
483+
call add(html, '<td><div>')
485484
elseif s:settings.use_xhtml
486485
call add(html, '<td nowrap="nowrap" valign="top"><div>')
487486
else
@@ -515,7 +514,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
515514
let name = substitute(name, '\d*\.x\?html$', '', '') . i . '.' . fnamemodify(copy(name), ":t:e")
516515
let i += 1
517516
endwhile
517+
518+
let s:ei_sav = &eventignore
519+
set eventignore+=FileType
518520
exe "topleft new " . name
521+
let &eventignore=s:ei_sav
522+
unlet s:ei_sav
523+
519524
setlocal modifiable
520525

521526
" 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) "{{{
544549
" add required javascript in reverse order so we can just call append again
545550
" and again without adjusting {{{
546551

547-
let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy)
552+
let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids
548553

549554
" insert script closing tag if needed
550555
if s:uses_script
@@ -555,31 +560,6 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
555560
\ ])
556561
endif
557562

558-
" insert script which corrects the size of small input elements in
559-
" prevent_copy mode. See 2html.vim for details on why this is needed and how
560-
" it works.
561-
if !empty(s:settings.prevent_copy)
562-
call append(style_start, [
563-
\ '',
564-
\ '/* simulate a "ch" unit by asking the browser how big a zero character is */',
565-
\ 'function FixCharWidth() {',
566-
\ ' /* get the hidden element which gives the width of a single character */',
567-
\ ' var goodWidth = document.getElementById("oneCharWidth").clientWidth;',
568-
\ ' /* get all input elements, we''ll filter on class later */',
569-
\ ' var inputTags = document.getElementsByTagName("input");',
570-
\ ' var ratio = 5;',
571-
\ ' var inputWidth = document.getElementById("oneInputWidth").clientWidth;',
572-
\ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;',
573-
\ ' if (inputWidth > goodWidth) {',
574-
\ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {',
575-
\ ' ratio += 5;',
576-
\ ' }',
577-
\ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;',
578-
\ ' }',
579-
\ '}'
580-
\ ])
581-
endif
582-
583563
" insert javascript to get IDs from line numbers, and to open a fold before
584564
" jumping to any lines contained therein
585565
if s:settings.line_ids
@@ -659,10 +639,9 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
659639
endif
660640

661641
if s:uses_script
662-
" insert script tag; javascript is always needed for the line number
663-
" normalization for URL hashes
642+
" insert script tag if needed
664643
call append(style_start, [
665-
\ "<script type='text/javascript'>",
644+
\ "<script" . (s:html5 ? "" : " type='text/javascript'") . ">",
666645
\ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
667646
endif
668647

@@ -673,11 +652,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
673652
" is pretty useless for really long lines. {{{
674653
if s:settings.use_css
675654
call append(style_start,
676-
\ ['<style type="text/css">']+
655+
\ ['<style' . (s:html5 ? '' : 'type="text/css"') . '>']+
677656
\ style+
678657
\ [ s:settings.use_xhtml ? '' : '<!--',
679658
\ 'table { table-layout: fixed; }',
680659
\ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }',
660+
\ 'table, td, th { border: 1px solid; }',
661+
\ 'td { vertical-align: top; }',
681662
\ 'th, td { width: '.printf("%.1f",100.0/len(a:win_list)).'%; }',
682663
\ 'td div { overflow: auto; }',
683664
\ s:settings.use_xhtml ? '' : '-->',
@@ -720,21 +701,22 @@ func! tohtml#GetUserSettings() "{{{
720701
endif
721702

722703
" get current option settings with appropriate defaults {{{
723-
call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") )
724-
call tohtml#GetOption(user_settings, 'diff_one_file', 0 )
725-
call tohtml#GetOption(user_settings, 'number_lines', &number )
726-
call tohtml#GetOption(user_settings, 'pre_wrap', &wrap )
727-
call tohtml#GetOption(user_settings, 'use_css', 1 )
728-
call tohtml#GetOption(user_settings, 'ignore_conceal', 0 )
729-
call tohtml#GetOption(user_settings, 'ignore_folding', 0 )
730-
call tohtml#GetOption(user_settings, 'dynamic_folds', 0 )
731-
call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding)
732-
call tohtml#GetOption(user_settings, 'hover_unfold', 0 )
733-
call tohtml#GetOption(user_settings, 'no_pre', 0 )
734-
call tohtml#GetOption(user_settings, 'no_invalid', 0 )
735-
call tohtml#GetOption(user_settings, 'whole_filler', 0 )
736-
call tohtml#GetOption(user_settings, 'use_xhtml', 0 )
737-
call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines )
704+
call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") )
705+
call tohtml#GetOption(user_settings, 'diff_one_file', 0 )
706+
call tohtml#GetOption(user_settings, 'number_lines', &number )
707+
call tohtml#GetOption(user_settings, 'pre_wrap', &wrap )
708+
call tohtml#GetOption(user_settings, 'use_css', 1 )
709+
call tohtml#GetOption(user_settings, 'ignore_conceal', 0 )
710+
call tohtml#GetOption(user_settings, 'ignore_folding', 0 )
711+
call tohtml#GetOption(user_settings, 'dynamic_folds', 0 )
712+
call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding)
713+
call tohtml#GetOption(user_settings, 'hover_unfold', 0 )
714+
call tohtml#GetOption(user_settings, 'no_pre', 0 )
715+
call tohtml#GetOption(user_settings, 'no_invalid', 0 )
716+
call tohtml#GetOption(user_settings, 'whole_filler', 0 )
717+
call tohtml#GetOption(user_settings, 'use_xhtml', 0 )
718+
call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines )
719+
call tohtml#GetOption(user_settings, 'use_input_for_pc', 'fallback')
738720
" }}}
739721

740722
" override those settings that need it {{{
@@ -868,6 +850,16 @@ func! tohtml#GetUserSettings() "{{{
868850
let user_settings.no_invalid = 0
869851
endif
870852

853+
" enforce valid values for use_input_for_pc
854+
if user_settings.use_input_for_pc !~# 'fallback\|none\|all'
855+
let user_settings.use_input_for_pc = 'fallback'
856+
echohl WarningMsg
857+
echomsg '2html: "' . g:html_use_input_for_pc . '" is not valid for g:html_use_input_for_pc'
858+
echomsg '2html: defaulting to "' . user_settings.use_input_for_pc . '"'
859+
echohl None
860+
sleep 3
861+
endif
862+
871863
if exists('g:html_id_expr')
872864
let user_settings.id_suffix = eval(g:html_id_expr)
873865
if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$'

runtime/doc/eval.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.1. Last change: 2019 Nov 06
1+
*eval.txt* For Vim version 8.1. Last change: 2019 Nov 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -11585,21 +11585,6 @@ text...
1158511585
Unlock the internal variable {name}. Does the
1158611586
opposite of |:lockvar|.
1158711587

11588-
*:eval*
11589-
:eval {expr} Evaluate {expr} and discard the result. Example: >
11590-
:eval Getlist()->Filter()->append('$')
11591-
11592-
< The expression is supposed to have a side effect,
11593-
since the resulting value is not used. In the example
11594-
the `append()` call appends the List with text to the
11595-
buffer. This is similar to `:call` but works with any
11596-
expression.
11597-
11598-
The command can be shortened to `:ev` or `:eva`, but
11599-
these are hard to recognize and therefore not to be
11600-
used.
11601-
11602-
1160311588
:if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580*
1160411589
:en[dif] Execute the commands until the next matching ":else"
1160511590
or ":endif" if {expr1} evaluates to non-zero.
@@ -11886,6 +11871,21 @@ text...
1188611871
And to get a beep: >
1188711872
:exe "normal \<Esc>"
1188811873
<
11874+
*:eval*
11875+
:eval {expr} Evaluate {expr} and discard the result. Example: >
11876+
:eval Getlist()->Filter()->append('$')
11877+
11878+
< The expression is supposed to have a side effect,
11879+
since the resulting value is not used. In the example
11880+
the `append()` call appends the List with text to the
11881+
buffer. This is similar to `:call` but works with any
11882+
expression.
11883+
11884+
The command can be shortened to `:ev` or `:eva`, but
11885+
these are hard to recognize and therefore not to be
11886+
used.
11887+
11888+
1188911889
*:exe* *:execute*
1189011890
:exe[cute] {expr1} .. Executes the string that results from the evaluation
1189111891
of {expr1} as an Ex command.

runtime/doc/gui.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*gui.txt* For Vim version 8.1. Last change: 2019 Nov 10
1+
*gui.txt* For Vim version 8.1. Last change: 2019 Nov 16
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -309,7 +309,7 @@ because the menu command will always be applied to the top window.
309309

310310
If you are on the ':' line (or '/' or '?'), then clicking the left or right
311311
mouse button will position the cursor on the ':' line (if 'mouse' contains
312-
'c', 'a' or 'A').
312+
'c' or 'a').
313313

314314
In any situation the middle mouse button may be clicked to paste the current
315315
selection.

runtime/doc/motion.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*motion.txt* For Vim version 8.1. Last change: 2019 Nov 04
1+
*motion.txt* For Vim version 8.1. Last change: 2019 Nov 16
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -964,6 +964,7 @@ These commands are not marks themselves, but jump to a mark:
964964
- numbered marks '0 - '9
965965
- last insert position '^
966966
- last change position '.
967+
- last affected text area '[ and ']
967968
- the Visual area '< and '>
968969
- line numbers in placed signs
969970
- line numbers in quickfix positions

runtime/doc/pi_netrw.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Nov 10
1+
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Nov 14
22

33
------------------------------------------------
44
NETRW REFERENCE MANUAL by Charles E. Campbell
@@ -1184,7 +1184,7 @@ One may easily "bookmark" the currently browsed directory by using >
11841184
*.netrwbook*
11851185
Bookmarks are retained in between sessions of vim in a file called .netrwbook
11861186
as a |List|, which is typically stored in the first directory on the user's
1187-
|'runtimepath'|; entries are kept in sorted order.
1187+
'runtimepath'; entries are kept in sorted order.
11881188

11891189
If there are marked files and/or directories, mb will add them to the bookmark
11901190
list.
@@ -3512,7 +3512,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
35123512
- Click "Add..."
35133513
- Set External Editor (adjust path as needed, include
35143514
the quotes and !.! at the end):
3515-
"c:\Program Files\Vim\vim881\gvim.exe" !.!
3515+
"c:\Program Files\Vim\vim81\gvim.exe" !.!
35163516
- Check that the filetype in the box below is
35173517
{asterisk}.{asterisk} (all files), or whatever types
35183518
you want (cec: change {asterisk} to * ; I had to

runtime/doc/popup.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*popup.txt* For Vim version 8.1. Last change: 2019 Nov 11
1+
*popup.txt* For Vim version 8.1. Last change: 2019 Nov 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -863,7 +863,7 @@ Some recommended key actions:
863863
Tab accept current suggestion
864864

865865
A mouse click arrives as <LeftMouse>. The coordinates can be obtained with
866-
|mousegetpos()|.
866+
|getmousepos()|.
867867

868868
Vim provides standard filters |popup_filter_menu()| and
869869
|popup_filter_yesno()|.

0 commit comments

Comments
 (0)