To: vim-dev@vim.org Subject: Patch 6.2.527 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.527 Problem: The 2html script uses ":wincmd p", which breaks when using some autocommands. Solution: Remember the window numbers and jump to them with ":wincmd w". Also add XHTML support. (Panagiotis Issaris) Files: runtime/syntax/2html.vim *** ../vim-6.2.526/runtime/syntax/2html.vim Mon Dec 29 20:49:00 2003 --- runtime/syntax/2html.vim Wed May 5 11:17:45 2004 *************** *** 1,7 **** " Vim syntax support file " Maintainer: Bram Moolenaar ! " Last Change: 2003 Nov 13 " (modified by David Ne\v{c}as (Yeti) ) " Transform a file into HTML, using the current syntax highlighting. --- 1,8 ---- " Vim syntax support file " Maintainer: Bram Moolenaar ! " Last Change: 2004 May 05 " (modified by David Ne\v{c}as (Yeti) ) + " (XHTML support by Panagiotis Issaris ) " Transform a file into HTML, using the current syntax highlighting. *************** *** 168,178 **** --- 169,183 ---- set report=1000000 " Split window to create a buffer with the HTML file. + let s:orgbufnr = winbufnr(0) if expand("%") == "" new Untitled.html else new %.html endif + let s:newwin = winnr() + let s:orgwin = bufwinnr(s:orgbufnr) + set modifiable %d let s:old_paste = &paste *************** *** 180,192 **** let s:old_magic = &magic set magic " HTML header, with the title and generator ;-). Left free space for the CSS, " to be filled at the end. exe "normal! a\n\n\e" exe "normal! a" . expand("%:p:~") . "\n\e" ! exe "normal! a\n\e" if s:html_encoding != "" ! exe "normal! a\n\e" endif if exists("html_use_css") exe "normal! a\n\e" --- 185,204 ---- let s:old_magic = &magic set magic + if exists("use_xhtml") + exe "normal! a\n\e" + let tag_close = '/>' + else + let tag_close = '>' + endif + " HTML header, with the title and generator ;-). Left free space for the CSS, " to be filled at the end. exe "normal! a\n\n\e" exe "normal! a" . expand("%:p:~") . "\n\e" ! exe "normal! a\n\n\n\e" *************** *** 197,203 **** exe "normal! a\n\n
\n\e"
  endif
  
! wincmd p
  
  " List of all id's
  let s:idlist = ","
--- 209,215 ----
    exe "normal! a\n\n
\n\e"
  endif
  
! exe s:orgwin . "wincmd w"
  
  " List of all id's
  let s:idlist = ","
***************
*** 274,290 ****
    endwhile
  
    if exists("html_no_pre")
!     let s:new = substitute(s:new, '  ', '\ \ ', 'g') . '
' endif ! exe "normal! \pa" . strtrans(s:new) . "\n\e\p" let s:lnum = s:lnum + 1 + endwhile " Finish with the last line if exists("html_no_pre") ! exe "normal! \pa\n\n\e" else ! exe "normal! \pa
\n\n\e" endif --- 286,309 ---- endwhile if exists("html_no_pre") ! if exists("use_xhtml") ! let s:new = substitute(s:new, ' ', '\ \ ', 'g') . '
' ! else ! let s:new = substitute(s:new, ' ', '\ \ ', 'g') . '
' ! endif endif ! exe s:newwin . "wincmd w" ! exe "normal! a" . strtrans(s:new) . "\n\e" ! exe s:orgwin . "wincmd w" let s:lnum = s:lnum + 1 + endwhile " Finish with the last line + exe s:newwin . "wincmd w" if exists("html_no_pre") ! exe "normal! a\n\n\e" else ! exe "normal! a
\n\n\e" endif *************** *** 375,388 **** let &paste = s:old_paste let &magic = s:old_magic let @/ = s:old_search ! wincmd p let &l:et = s:old_et ! wincmd p ! " Save a little bit of memory (worths doing?) unlet s:old_et s:old_paste s:old_icon s:old_report s:old_title s:old_search unlet s:whatterm s:idlist s:lnum s:end s:fgc s:bgc s:old_magic unlet! s:col s:id s:attr s:len s:line s:new s:did_retab s:numblines delfunc s:HtmlColor delfunc s:CSS1 if !exists("html_use_css") --- 394,408 ---- let &paste = s:old_paste let &magic = s:old_magic let @/ = s:old_search ! exe s:orgwin . "wincmd w" let &l:et = s:old_et ! exe s:newwin . "wincmd w" ! " Save a little bit of memory (worth doing?) unlet s:old_et s:old_paste s:old_icon s:old_report s:old_title s:old_search unlet s:whatterm s:idlist s:lnum s:end s:fgc s:bgc s:old_magic unlet! s:col s:id s:attr s:len s:line s:new s:did_retab s:numblines + unlet s:orgwin s:newwin s:orgbufnr delfunc s:HtmlColor delfunc s:CSS1 if !exists("html_use_css") *** ../vim-6.2.526/src/version.c Tue May 4 21:16:25 2004 --- src/version.c Wed May 5 11:15:10 2004 *************** *** 639,640 **** --- 642,645 ---- { /* Add new patch number below this line */ + /**/ + 527, /**/ -- Corduroy pillows: They're making headlines! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///