0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.2144

Problem:    On MS-Windows quickix does not handle a line with 1023 bytes
            ending in CR-LF properly.
Solution:   Don't consider CR a line break. (Ken Takata)
This commit is contained in:
Bram Moolenaar 2016-08-02 21:41:28 +02:00
parent bc8801c931
commit 796aa9c804
2 changed files with 9 additions and 17 deletions

View File

@ -651,11 +651,7 @@ qf_get_next_file_line(qfstate_T *state)
discard = FALSE; discard = FALSE;
state->linelen = (int)STRLEN(IObuff); state->linelen = (int)STRLEN(IObuff);
if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n' if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'))
#ifdef USE_CRNL
|| IObuff[state->linelen - 1] == '\r'
#endif
))
{ {
/* /*
* The current line exceeds IObuff, continue reading using * The current line exceeds IObuff, continue reading using
@ -680,11 +676,7 @@ qf_get_next_file_line(qfstate_T *state)
break; break;
state->linelen = (int)STRLEN(state->growbuf + growbuflen); state->linelen = (int)STRLEN(state->growbuf + growbuflen);
growbuflen += state->linelen; growbuflen += state->linelen;
if ((state->growbuf)[growbuflen - 1] == '\n' if ((state->growbuf)[growbuflen - 1] == '\n')
#ifdef USE_CRNL
|| (state->growbuf)[growbuflen - 1] == '\r'
#endif
)
break; break;
if (state->growbufsiz == LINE_MAXLEN) if (state->growbufsiz == LINE_MAXLEN)
{ {
@ -708,11 +700,7 @@ qf_get_next_file_line(qfstate_T *state)
*/ */
if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL
|| (int)STRLEN(IObuff) < IOSIZE - 1 || (int)STRLEN(IObuff) < IOSIZE - 1
|| IObuff[IOSIZE - 1] == '\n' || IObuff[IOSIZE - 1] == '\n')
#ifdef USE_CRNL
|| IObuff[IOSIZE - 1] == '\r'
#endif
)
break; break;
} }
@ -757,11 +745,13 @@ qf_get_nextline(qfstate_T *state)
/* remove newline/CR from the line */ /* remove newline/CR from the line */
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n') if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n')
{
state->linebuf[state->linelen - 1] = NUL; state->linebuf[state->linelen - 1] = NUL;
#ifdef USE_CRNL #ifdef USE_CRNL
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\r') if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r')
state->linebuf[state->linelen - 1] = NUL; state->linebuf[state->linelen - 2] = NUL;
#endif #endif
}
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
remove_bom(state->linebuf); remove_bom(state->linebuf);

View File

@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2144,
/**/ /**/
2143, 2143,
/**/ /**/