mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
\r terminates a line only if followed by \n or the end of the buffer
This commit is contained in:
parent
b40400d59c
commit
5f606a2829
1 changed files with 5 additions and 2 deletions
|
@ -137,13 +137,16 @@ COM_extract_line (cbuf_t *cbuf)
|
||||||
break;
|
break;
|
||||||
if (text[i] == '/' && text[i + 1] == '/') {
|
if (text[i] == '/' && text[i + 1] == '/') {
|
||||||
int j = i;
|
int j = i;
|
||||||
while (j < len && text[j] != '\n' && text[j] != '\r')
|
while (j < len && text[j] != '\n'
|
||||||
|
&& (text[j] != '\r'
|
||||||
|
|| (j < len - 1 && text[j + 1] != '\n')))
|
||||||
j++;
|
j++;
|
||||||
dstring_snip (cbuf->buf, i, j - i);
|
dstring_snip (cbuf->buf, i, j - i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (text[i] == '\n' || text[i] == '\r')
|
if (text[i] == '\n'
|
||||||
|
|| (text[i] == '\r' && (i == len - 1 || text[ i + 1] == '\n')))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i)
|
if (i)
|
||||||
|
|
Loading…
Reference in a new issue