Fix #544: Handle long lines while formatting

This commit is contained in:
Karl Yngve Lervåg 2016-09-11 23:26:53 +02:00
parent ec18d3b9a7
commit be6d03b7cc
2 changed files with 32 additions and 0 deletions

View File

@ -110,6 +110,12 @@ function! s:format(top, bottom) " {{{1
continue
endif
" Handle long lines
if len(l:line) > s:textwidth
let l:bottom += s:format_build_lines(l:current, l:mark)
let l:mark = l:current-1
endif
if l:line =~# s:border_end
if l:current < l:mark
let l:bottom += s:format_build_lines(l:current+1, l:mark)

View File

@ -174,3 +174,29 @@ Expect tex (Verify):
is an approximation whose coefficients become \emph{non-universal} (dependent
on intial conditions) and \emph{time-dependent}.
Given tex (Format: Enumerate env):
\begin{enumerate}[(i)]
\item xxxxxxxxxx xx xxxxxx xxxxxx xx xxxxxxxxxx xxxxxxx xxxxxxx xxx
xxxxxxxxxx xxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxx xxxx xxxxx xxxxxxxxxxx xxxxxxx
xxxxxxxxxxxx xxxx xxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxxxx
xx xxxxxxxxx
\item xxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxx xxxxxx xxxxxxxxxxxxxx xxx
xxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxx
xxxxxxxxxxxxxxxxx xxxxx xxxxxxx
\end{enumerate}
Do (Format text):
gqG
Expect tex (Verify):
\begin{enumerate}[(i)]
\item xxxxxxxxxx xx xxxxxx xxxxxx xx xxxxxxxxxx xxxxxxx xxxxxxx xxx
xxxxxxxxxx xxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxx xxxx xxxxx xxxxxxxxxxx
xxxxxxx xxxxxxxxxxxx xxxx xxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxxx
xxxxxxxxx xx xxxxxxxxx
\item xxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxx xxxxxx xxxxxxxxxxxxxx xxx
xxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxx
xxxxxxxxxxxxxxxxx xxxxx xxxxxxx
\end{enumerate}