Hi,
I found that QuickFix on Windows doesn't handle CRNL line endings properly.
E.g.:
1. Create a batch file that outputs 1023 bytes in a line.
> gvim maketest.bat
a@echo <Esc>1023aa<Esc>ZZ
2. Call the batch file from :make.
> gvim
:set makeprg=maketest.bat
:make
:copen
maketest.bat outputs only one line, but :copen shows two lines. (A line with
aaaaa... and an empty line.)
Another problem is that ^M is added at the end of each line.
E.g.:
1. Create a batch file that outputs "foo".
> gvim maketest.bat
a@echo foo<Esc>ZZ
2. Call the batch file from :make.
> gvim
:set makeprg=maketest.bat
:make
:copen
:copen shows "|| foo^M" instead of "|| foo".
Attached patch fixes the problems.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent cd2ad111c7fb6dfab95b5397fd90fa8d90e4ad77
diff --git a/src/quickfix.c b/src/quickfix.c
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -651,11 +651,7 @@ qf_get_next_file_line(qfstate_T *state)
discard = FALSE;
state->linelen = (int)STRLEN(IObuff);
- if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'
-#ifdef USE_CRNL
- || IObuff[state->linelen - 1] == '\r'
-#endif
- ))
+ if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'))
{
/*
* The current line exceeds IObuff, continue reading using
@@ -680,11 +676,7 @@ qf_get_next_file_line(qfstate_T *state)
break;
state->linelen = (int)STRLEN(state->growbuf + growbuflen);
growbuflen += state->linelen;
- if ((state->growbuf)[growbuflen - 1] == '\n'
-#ifdef USE_CRNL
- || (state->growbuf)[growbuflen - 1] == '\r'
-#endif
- )
+ if ((state->growbuf)[growbuflen - 1] == '\n')
break;
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
|| (int)STRLEN(IObuff) < IOSIZE - 1
- || IObuff[IOSIZE - 1] == '\n'
-#ifdef USE_CRNL
- || IObuff[IOSIZE - 1] == '\r'
-#endif
- )
+ || IObuff[IOSIZE - 1] == '\n')
break;
}
@@ -757,11 +745,13 @@ qf_get_nextline(qfstate_T *state)
/* remove newline/CR from the line */
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n')
+ {
state->linebuf[state->linelen - 1] = NUL;
#ifdef USE_CRNL
- if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\r')
- state->linebuf[state->linelen - 1] = NUL;
+ if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r')
+ state->linebuf[state->linelen - 2] = NUL;
#endif
+ }
#ifdef FEAT_MBYTE
remove_bom(state->linebuf);