Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: > > substr(0, x) == foo > > we have lstring functions for that > > prefixIs("Index:", foo) >
Thanks Lars. Latest patch (using prefixIs) attached. -- Enrico --- src/LaTeX.C.orig 2006-03-14 05:04:34.000000000 +0100 +++ src/LaTeX.C 2006-03-16 23:37:34.000000000 +0100 @@ -688,7 +688,7 @@ // On initial insert we want to do the update at once // since this file can not be a file generated by // the latex run. - if (fs::exists(foundfile)) + if (fs::exists(foundfile) && !fs::is_directory(foundfile)) head.insert(foundfile, true); return; @@ -750,20 +750,34 @@ static regex reg5("Writing index file ([^ ]+).*"); ifstream ifs(logfile.c_str()); + string line2; while (ifs) { // Ok, the scanning of files here is not sufficient. // Sometimes files are named by "File: xxx" only // So I think we should use some regexps to find files instead. // "(\([^ ]+\)" should match the "(file " variant, note // that we can have several of these on one line. - // "File: \([^ ]+\)" should match the "File: file" variant - - string token; - getline(ifs, token); - token = rtrim(token, "\r"); - if (token.empty()) + // "File: \([^ ]+\)" should match the "File: file" variant. + // As a path name may be split across lines, we use a sliding + // window comprising two lines at a time while scanning files. + + string const line1 = line2; + getline(ifs, line2); + if (!ifs) + break; + line2 = rtrim(line2, "\r"); + int const len = line2.length(); + char const endchar = len ? line2[len - 1] : 0; + // Check whether we can slide further down our 2-line window + if (line1.empty() + || prefixIs(line2, "File:") + || prefixIs(line2, "(Font)") + || prefixIs(line2, "Package:") + || prefixIs(line2, "Language:") + || endchar == '\\' || endchar == '/' || endchar == ')') continue; + string token = line1 + line2; smatch sub; if (regex_match(token, sub, reg1)) {