Skip to content

Commit 796aa9c

Browse files
committed
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)
1 parent bc8801c commit 796aa9c

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

src/quickfix.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,7 @@ qf_get_next_file_line(qfstate_T *state)
651651

652652
discard = FALSE;
653653
state->linelen = (int)STRLEN(IObuff);
654-
if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'
655-
#ifdef USE_CRNL
656-
|| IObuff[state->linelen - 1] == '\r'
657-
#endif
658-
))
654+
if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'))
659655
{
660656
/*
661657
* The current line exceeds IObuff, continue reading using
@@ -680,11 +676,7 @@ qf_get_next_file_line(qfstate_T *state)
680676
break;
681677
state->linelen = (int)STRLEN(state->growbuf + growbuflen);
682678
growbuflen += state->linelen;
683-
if ((state->growbuf)[growbuflen - 1] == '\n'
684-
#ifdef USE_CRNL
685-
|| (state->growbuf)[growbuflen - 1] == '\r'
686-
#endif
687-
)
679+
if ((state->growbuf)[growbuflen - 1] == '\n')
688680
break;
689681
if (state->growbufsiz == LINE_MAXLEN)
690682
{
@@ -708,11 +700,7 @@ qf_get_next_file_line(qfstate_T *state)
708700
*/
709701
if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL
710702
|| (int)STRLEN(IObuff) < IOSIZE - 1
711-
|| IObuff[IOSIZE - 1] == '\n'
712-
#ifdef USE_CRNL
713-
|| IObuff[IOSIZE - 1] == '\r'
714-
#endif
715-
)
703+
|| IObuff[IOSIZE - 1] == '\n')
716704
break;
717705
}
718706

@@ -757,11 +745,13 @@ qf_get_nextline(qfstate_T *state)
757745

758746
/* remove newline/CR from the line */
759747
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n')
748+
{
760749
state->linebuf[state->linelen - 1] = NUL;
761750
#ifdef USE_CRNL
762-
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\r')
763-
state->linebuf[state->linelen - 1] = NUL;
751+
if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r')
752+
state->linebuf[state->linelen - 2] = NUL;
764753
#endif
754+
}
765755

766756
#ifdef FEAT_MBYTE
767757
remove_bom(state->linebuf);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2144,
766768
/**/
767769
2143,
768770
/**/

0 commit comments

Comments
 (0)