Find usage displays content of the first line

Task-number: QTCREATERBUG-6176

Change-Id: I1c45b951bfde0b0d33bf462f532da7cbdbaa3fe7
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
David Schulz
2012-01-27 15:35:46 +01:00
committed by Leandro Melo
parent 3fe2113a2b
commit e44254bb9f

View File

@@ -50,17 +50,21 @@ QString fetchLine(const QByteArray &bytes, const int line)
{ {
int current = 0; int current = 0;
const char *s = bytes.constData(); const char *s = bytes.constData();
while (*s) {
if (*s == '\n') { if (line) {
++current; while (*s) {
if (current == line) if (*s == '\n') {
break; ++current;
if (line == current) {
++s;
break;
}
}
++s;
} }
++s;
} }
if (current == line) { if (current == line) {
++s;
const char *e = s; const char *e = s;
while (*e && *e != '\n') while (*e && *e != '\n')
++e; ++e;