]> git.lyx.org Git - features.git/commitdiff
fix to the lyxstring bug, better searching for dep files in latex log, use \hfil...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 31 May 2000 17:08:11 +0000 (17:08 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 31 May 2000 17:08:11 +0000 (17:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@785 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
lib/layouts/stdlists.inc
src/LaTeX.C
src/support/lyxstring.C

index c338e3b9610c986f3d4eb9053418dff565c12f0d..94632f61fb8b0eeecc6194cea22c136218cfd4c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2000-05-31  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/support/lyxstring.C (begin): fix a "shared" string bug. use
+       rep->get_own_copy()
+       (end): ditto
+
+       * src/LaTeX.C (deplog): better searching for dependency files in
+       the latex log. Uses now regexps.
+
+       * lib/layouts/stdlists.inc (lyxlist): fix the label to use \hfil
+       instead of the box hack or \hfill. 
+
 2000-05-31  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/lyxfunc.C (doImportHelper): do not create the file before
index 2525fda38c94284a7a8242bbdf8f0421d34a0e69..bac13bf5a46b62b02805d6111ae5f79e233967ab 100644 (file)
@@ -88,7 +88,7 @@ Style List
       {\settowidth{\labelwidth}{#1}
        \setlength{\leftmargin}{\labelwidth}
        \addtolength{\leftmargin}{\labelsep}
-       \renewcommand{\makelabel}[1]{\makebox[\labelwidth][l]{##1}}}}
+       \renewcommand{\makelabel}[1]{##1\hfil}}}
     {\end{list}}
   EndPreamble
 
index 310cc49ec383241bc8f5f228b648d320b9977787..70510fff61cf246430f3496f4563f688858f1a4c 100644 (file)
@@ -619,39 +619,49 @@ void LaTeX::deplog(DepTable & head)
        // dependency file.
 
        string logfile = OnlyFilename(ChangeExtension(file, ".log"));
-       
+
+       LRegex reg1(")* *\\(([^ ]+).*");
+       LRegex reg2("File: ([^ ]+).*");
+
        ifstream ifs(logfile.c_str());
        while (ifs) {
-               // Now we read chars until we find a '('
-               char c = 0;
-               while(ifs.get(c)) {
-                       if (c == '(') break;
-               };
-               if (!ifs) break;
-               
-               // We now have c == '(', we now read the the sequence of
-               // chars until reaching EOL, ' ' or ')' and put that
-               // into a string.
+               // 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
+               // "File: \([^ ]+\)" should match the "File: file" variant
                string foundfile;
-               while (ifs.get(c)) {
-                       if (c == '\n' || c == ' ' || c == ')')
-                               break;
-                       foundfile += c;
+               string token;
+               getline(ifs, token);
+               if (token.empty()) continue;
+               
+               if (reg1.exact_match(token)) {
+                       LRegex::SubMatches const & sub = reg1.exec(token);
+                       foundfile = LSubstring(token, sub[1].first,
+                                              sub[1].second);
+               } else if (reg2.exact_match(token)) {
+                       LRegex::SubMatches const & sub = reg2.exec(token);
+                       foundfile = LSubstring(token, sub[1].first,
+                                              sub[1].second);
+               } else {
+                       continue;
                }
+
                lyxerr[Debug::DEPEND] << "Found file: " 
                                     << foundfile << endl;
                
                // Ok now we found a file.
-               // Now we should make sure that
-               // this is a file that we can
-               // access through the normal
-               // paths:
+               // Now we should make sure that this is a file that we can
+               // access through the normal paths.
+               // We will not try any fance search methods to
+               // find the file.
+               
                // (1) foundfile is an
                //     absolute path and should
                //     be inserted.
                if (AbsolutePath(foundfile)) {
                        lyxerr[Debug::DEPEND] << "AbsolutePath file: " 
-                                            << foundfile << endl;
+                                             << foundfile << endl;
                        // On inital insert we want to do the update at once
                        // since this file can not be a file generated by
                        // the latex run.
index 606e689304baf35e3e50f1fcd10a990edd6352d2..d247be4b7fbec7b5882055602625cfe2cca53631 100644 (file)
@@ -460,6 +460,7 @@ lyxstring::~lyxstring()
 
 lyxstring::iterator lyxstring::begin()
 {
+       rep = rep->get_own_copy();
        return rep->s;
 }
 
@@ -472,6 +473,7 @@ lyxstring::const_iterator lyxstring::begin() const
 
 lyxstring::iterator lyxstring::end()
 {
+       rep = rep->get_own_copy();
        return rep->s + rep->sz;
 }